Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
util.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define APPEND_TO_STRING(list, sep, add)
#define bprintf(...)
#define COMPARE_INCREASING(to, from)
#define CTF_RECORD   "/ctf100record/"
#define CTS_RECORD   "/cts100record/"
#define FOR_EACH_TAG(v)
#define fprintf(file, ...)
#define GENTLE   (autocvar_cl_gentle || autocvar_cl_gentle_messages)
#define normal_or_gentle(normal, gentle)
#define RACE_RECORD   "/race100record/"
#define TIME_DECODE(n)
#define TIME_ENCODE(t)
#define TIME_ENCODED_TOSTRING(n, compact)
#define TIME_TO_NTHS(t, n)
#define XPD(...)

Typedefs

using findNextEntityNearFunction_t = entity(entity cur, entity near, entity pass)
using isConnectedFunction_t = float(entity a, entity b, entity pass)
using textLengthUpToLength_lenFunction_t = float(string s)
using textLengthUpToWidth_widthFunction_t = float(string s, vector size)

Functions

vector animfixfps (entity e, vector a, vector b)
entity Announcer_PickNumber (int type, int num)
void attach_sameorigin (entity e, entity to, string tag)
float blink (float base, float range, float freq)
float blink_synced (float base, float range, float freq, float start_time, int start_blink)
float CheckWireframeBox (entity forent, vector v0, vector dvx, vector dvy, vector dvz)
float compressShortVector (vector vec)
float compressShotOrigin (vector v)
float cvar_or (string cv, float v)
float cvar_settemp (string pKey, string pValue)
float cvar_settemp_restore ()
vector decompressShortVector (float data)
vector decompressShotOrigin (float f)
void depthfirst (entity start,.entity up,.entity downleft,.entity right, void(entity, entity) funcPre, void(entity, entity) funcPost, entity pass)
void detach_sameorigin (entity e)
void execute_next_frame ()
string find_last_color_code (string s)
vector findbetterlocation (vector org, float mindist)
void FindConnectedComponent (entity e,.entity fld, findNextEntityNearFunction_t nxt, isConnectedFunction_t iscon, entity pass)
string fixPriorityList (string pl, float from, float to, float subtract, float complete)
void follow_sameorigin (entity e, entity to)
void get_mi_min_max (float mode)
void get_mi_min_max_texcoords (float mode)
string get_model_datafilename (string mod, float skn, string fil)
float get_model_parameters (string mod, float skn)
vector get_shotvelocity (vector myvel, vector mydir, float spd, float newton_style, float mi, float ma)
string getcurrentmod ()
string getWrappedLine (float w, vector size, textLengthUpToWidth_widthFunction_t tw)
string getWrappedLineLen (float w, textLengthUpToLength_lenFunction_t tw)
vector healtharmor_applydamage (float a, float armorblock, int deathtype, float damage)
vector healtharmor_maxdamage (float h, float a, float armorblock, int deathtype)
float isGametypeInFilter (entity gt, float tp, float ts, string pattern)
int LostMovetypeFollow (entity ent)
string mapPriorityList (string order, string(string) mapfunc)
float matchacl (string acl, string str)
int Mod_Q1BSP_NativeContentsFromSuperContents (int supercontents)
int Mod_Q1BSP_SuperContentsFromNativeContents (int nativecontents)
string playername (string thename, int teamid, bool team_colorize)
void queue_to_execute_next_frame (string s)
vector real_origin (entity ent)
string ScoreString (float vflags, float value, int rounds_played)
void SetMovetypeFollow (entity ent, entity e)
void Shutdown ()
void Skeleton_SetBones (entity e)
vector solve_shotdirection (vector myorg, vector myvel, vector eorg, vector evel, float spd, float newton_style)
 STATIC_INIT (g_saved_cvars)
string strtolower (string s)
string swapInPriorityList (string order, float i, float j)
float textLengthUpToLength (string theText, int maxLength, textLengthUpToLength_lenFunction_t tw)
float textLengthUpToWidth (string theText, float maxWidth, vector size, textLengthUpToWidth_widthFunction_t tw)
string textShortenToLength (string theText, int maxLength, textLengthUpToLength_lenFunction_t tw)
string textShortenToWidth (string theText, float maxWidth, vector size, textLengthUpToWidth_widthFunction_t tw)
float trace_hits_box (vector start, vector end, vector thmi, vector thma)
float trace_hits_box_1d (float end, float thmi, float thma)
float tracebox_hits_box (vector start, vector mi, vector ma, vector end, vector thmi, vector thma)
float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity)
void traceline_inverted (vector v1, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity)
ERASEABLE string translate_key (string key)
void UnsetMovetypeFollow (entity ent)
string wordwrap (string s, float l)
void wordwrap_cb (string s, float l, void(string) callback)
void wordwrap_sprint (entity to, string s, float l)
void write_String_To_File (int fh, string str, bool alsoprint)
float xdecode (string s)
string xencode (float f)

Variables

bool autocvar_cl_gentle
int autocvar_cl_gentle_messages
const int CNT_GAMESTART = 2
const int CNT_KILL = 4
const int CNT_NORMAL = 1
const int CNT_RESPAWN = 5
const int CNT_ROUNDSTART = 6
string config_queue [MAX_CONFIG_SETTINGS]
IntrusiveList g_saved_cvars
float get_model_parameters_age
string get_model_parameters_bone_aim [MAX_AIM_BONES]
float get_model_parameters_bone_aimweight [MAX_AIM_BONES]
string get_model_parameters_bone_upperbody
string get_model_parameters_bone_weapon
string get_model_parameters_desc
string get_model_parameters_description
float get_model_parameters_fixbone
bool get_model_parameters_hidden
string get_model_parameters_modelname
float get_model_parameters_modelskin
string get_model_parameters_name
string get_model_parameters_sex
float get_model_parameters_species
float get_model_parameters_weight
string getWrappedLine_remaining
string ladder_reply
string lsmaps_reply
string maplist_reply
const int MAX_AIM_BONES = 4
const int MAX_CONFIG_SETTINGS = 70
string message
vector mi_max
vector mi_min
vector mi_picmax
vector mi_picmin
vector mi_pictexcoord0
vector mi_pictexcoord1
vector mi_pictexcoord2
vector mi_pictexcoord3
string mi_shortname
string monsterlist_reply
string netname
string rankings_reply
string records_reply [10]
float skeleton_bones
const int TIME_DECIMALS = 2
const float TIME_FACTOR = 100
const float XENCODE_LEN = 5
const float XENCODE_MAX = 21295

Macro Definition Documentation

◆ APPEND_TO_STRING

#define APPEND_TO_STRING ( list,
sep,
add )
Value:
((list) = (((list) != "") ? strcat(list, sep, add) : (add)))
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

Definition at line 265 of file util.qh.

Referenced by UpdateNotification_URI_Get_Callback().

◆ bprintf

#define bprintf ( ...)
Value:
bprint(sprintf(__VA_ARGS__))
void bprint(string text,...)

Definition at line 232 of file util.qh.

Referenced by CheatsAllowed().

◆ COMPARE_INCREASING

#define COMPARE_INCREASING ( to,
from )
Value:
(to < from ? from + to + 2 : to - from)

Definition at line 268 of file util.qh.

Referenced by HitSound(), and UpdateDamage().

◆ CTF_RECORD

#define CTF_RECORD   "/ctf100record/"

Definition at line 99 of file util.qh.

Referenced by ctf_Initialize().

◆ CTS_RECORD

#define CTS_RECORD   "/cts100record/"

Definition at line 98 of file util.qh.

Referenced by cts_Initialize(), getladder(), and HUD_Mod_Race().

◆ FOR_EACH_TAG

#define FOR_EACH_TAG ( v)
Value:
float tagnum; Skeleton_SetBones(v); for(tagnum = 0; tagnum < v.skeleton_bones; tagnum++, gettaginfo(v, tagnum))
void Skeleton_SetBones(entity e)
Definition util.qc:1733
#define gettaginfo
Definition post.qh:32

Definition at line 216 of file util.qh.

Referenced by DamageEffect(), and MUTATOR_HOOKFUNCTION().

◆ fprintf

#define fprintf ( file,
... )
Value:
fputs(file, sprintf(__VA_ARGS__))
void fputs(float fhandle, string s)

Definition at line 231 of file util.qh.

◆ GENTLE

◆ normal_or_gentle

#define normal_or_gentle ( normal,
gentle )
Value:
((GENTLE && (gentle != "")) ? gentle : normal)
#define GENTLE
Definition util.qh:238

Definition at line 243 of file util.qh.

Referenced by notif_arg_spree_cen(), and notif_arg_spree_inf().

◆ RACE_RECORD

#define RACE_RECORD   "/race100record/"

Definition at line 97 of file util.qh.

Referenced by getladder(), HUD_Mod_Race(), rc_SetLimits(), and spawnfunc().

◆ TIME_DECODE

#define TIME_DECODE ( n)
Value:
((n) / TIME_FACTOR)
const float TIME_FACTOR
Definition util.qh:95

Definition at line 101 of file util.qh.

Referenced by HUD_RaceTimer(), HUD_Timer_Color(), and race_setTime().

◆ TIME_ENCODE

◆ TIME_ENCODED_TOSTRING

#define TIME_ENCODED_TOSTRING ( n,
compact )

◆ TIME_TO_NTHS

#define TIME_TO_NTHS ( t,
n )
Value:
floor((t) * (n) + 0.5)
float floor(float f)

Definition at line 92 of file util.qh.

◆ XPD

#define XPD ( ...)
Value:
__VA_ARGS__

Definition at line 228 of file util.qh.

Typedef Documentation

◆ findNextEntityNearFunction_t

Definition at line 223 of file util.qh.

◆ isConnectedFunction_t

Definition at line 224 of file util.qh.

◆ textLengthUpToLength_lenFunction_t

Definition at line 141 of file util.qh.

◆ textLengthUpToWidth_widthFunction_t

Definition at line 140 of file util.qh.

Function Documentation

◆ animfixfps()

vector animfixfps ( entity e,
vector a,
vector b )

Definition at line 1808 of file util.qc.

1809{
1810 // multi-frame anim: keep as-is
1811 if(a.y == 1)
1812 {
1813 float dur = frameduration(e.modelindex, a.x);
1814 if (dur <= 0 && b.y)
1815 {
1816 a = b;
1817 dur = frameduration(e.modelindex, a.x);
1818 }
1819 if (dur > 0)
1820 a.z = 1.0 / dur;
1821 }
1822 return a;
1823}

◆ Announcer_PickNumber()

entity Announcer_PickNumber ( int type,
int num )

Definition at line 1827 of file util.qc.

1828{
1829 return = NULL;
1830 switch (type)
1831 {
1832 case CNT_GAMESTART:
1833 {
1834 switch(num)
1835 {
1836 case 10: return ANNCE_NUM_GAMESTART_10;
1837 case 9: return ANNCE_NUM_GAMESTART_9;
1838 case 8: return ANNCE_NUM_GAMESTART_8;
1839 case 7: return ANNCE_NUM_GAMESTART_7;
1840 case 6: return ANNCE_NUM_GAMESTART_6;
1841 case 5: return ANNCE_NUM_GAMESTART_5;
1842 case 4: return ANNCE_NUM_GAMESTART_4;
1843 case 3: return ANNCE_NUM_GAMESTART_3;
1844 case 2: return ANNCE_NUM_GAMESTART_2;
1845 case 1: return ANNCE_NUM_GAMESTART_1;
1846 }
1847 break;
1848 }
1849 case CNT_KILL:
1850 {
1851 switch(num)
1852 {
1853 case 10: return ANNCE_NUM_KILL_10;
1854 case 9: return ANNCE_NUM_KILL_9;
1855 case 8: return ANNCE_NUM_KILL_8;
1856 case 7: return ANNCE_NUM_KILL_7;
1857 case 6: return ANNCE_NUM_KILL_6;
1858 case 5: return ANNCE_NUM_KILL_5;
1859 case 4: return ANNCE_NUM_KILL_4;
1860 case 3: return ANNCE_NUM_KILL_3;
1861 case 2: return ANNCE_NUM_KILL_2;
1862 case 1: return ANNCE_NUM_KILL_1;
1863 }
1864 break;
1865 }
1866 case CNT_RESPAWN:
1867 {
1868 switch(num)
1869 {
1870 case 10: return ANNCE_NUM_RESPAWN_10;
1871 case 9: return ANNCE_NUM_RESPAWN_9;
1872 case 8: return ANNCE_NUM_RESPAWN_8;
1873 case 7: return ANNCE_NUM_RESPAWN_7;
1874 case 6: return ANNCE_NUM_RESPAWN_6;
1875 case 5: return ANNCE_NUM_RESPAWN_5;
1876 case 4: return ANNCE_NUM_RESPAWN_4;
1877 case 3: return ANNCE_NUM_RESPAWN_3;
1878 case 2: return ANNCE_NUM_RESPAWN_2;
1879 case 1: return ANNCE_NUM_RESPAWN_1;
1880 }
1881 break;
1882 }
1883 case CNT_ROUNDSTART:
1884 {
1885 switch(num)
1886 {
1887 case 10: return ANNCE_NUM_ROUNDSTART_10;
1888 case 9: return ANNCE_NUM_ROUNDSTART_9;
1889 case 8: return ANNCE_NUM_ROUNDSTART_8;
1890 case 7: return ANNCE_NUM_ROUNDSTART_7;
1891 case 6: return ANNCE_NUM_ROUNDSTART_6;
1892 case 5: return ANNCE_NUM_ROUNDSTART_5;
1893 case 4: return ANNCE_NUM_ROUNDSTART_4;
1894 case 3: return ANNCE_NUM_ROUNDSTART_3;
1895 case 2: return ANNCE_NUM_ROUNDSTART_2;
1896 case 1: return ANNCE_NUM_ROUNDSTART_1;
1897 }
1898 break;
1899 }
1900 case CNT_NORMAL:
1901 default:
1902 {
1903 switch(num)
1904 {
1905 case 10: return ANNCE_NUM_10;
1906 case 9: return ANNCE_NUM_9;
1907 case 8: return ANNCE_NUM_8;
1908 case 7: return ANNCE_NUM_7;
1909 case 6: return ANNCE_NUM_6;
1910 case 5: return ANNCE_NUM_5;
1911 case 4: return ANNCE_NUM_4;
1912 case 3: return ANNCE_NUM_3;
1913 case 2: return ANNCE_NUM_2;
1914 case 1: return ANNCE_NUM_1;
1915 }
1916 break;
1917 }
1918 }
1919}
const int CNT_NORMAL
Definition util.qh:251
const int CNT_RESPAWN
Definition util.qh:255
const int CNT_KILL
Definition util.qh:254
const int CNT_ROUNDSTART
Definition util.qh:256
const int CNT_GAMESTART
Definition util.qh:252
#define NULL
Definition post.qh:14

References CNT_GAMESTART, CNT_KILL, CNT_NORMAL, CNT_RESPAWN, CNT_ROUNDSTART, and NULL.

Referenced by Announcer_Countdown(), instagib_countdown(), KillIndicator_Think(), and ShowRespawnCountdown().

◆ attach_sameorigin()

void attach_sameorigin ( entity e,
entity to,
string tag )

Definition at line 1960 of file util.qc.

1961{
1962 vector org, t_forward, t_left, t_up, e_forward, e_up;
1963 float tagscale;
1964
1965 org = e.origin - gettaginfo(to, gettagindex(to, tag));
1966 tagscale = (vlen(v_forward) ** -2); // undo a scale on the tag
1967 t_forward = v_forward * tagscale;
1968 t_left = v_right * -tagscale;
1969 t_up = v_up * tagscale;
1970
1971 e.origin_x = org * t_forward;
1972 e.origin_y = org * t_left;
1973 e.origin_z = org * t_up;
1974
1975 // current forward and up directions
1976 if (substring(e.model, 0, 1) == "*") // bmodels have their own rules
1977 e.angles = AnglesTransform_FromVAngles(e.angles);
1978 else
1979 e.angles = AnglesTransform_FromAngles(e.angles);
1980 fixedmakevectors(e.angles);
1981
1982 // untransform forward, up!
1983 e_forward.x = v_forward * t_forward;
1984 e_forward.y = v_forward * t_left;
1985 e_forward.z = v_forward * t_up;
1986 e_up.x = v_up * t_forward;
1987 e_up.y = v_up * t_left;
1988 e_up.z = v_up * t_up;
1989
1990 e.angles = fixedvectoangles2(e_forward, e_up);
1991 if (substring(e.model, 0, 1) == "*") // bmodels have their own rules
1992 e.angles = AnglesTransform_ToVAngles(e.angles);
1993 else
1994 e.angles = AnglesTransform_ToAngles(e.angles);
1995
1996 setattachment(e, to, tag);
1997 setorigin(e, e.origin);
1998}
vector AnglesTransform_ToAngles(vector v)
vector AnglesTransform_ToVAngles(vector v)
vector AnglesTransform_FromAngles(vector v)
vector AnglesTransform_FromVAngles(vector v)
#define fixedvectoangles2
void fixedmakevectors(vector a)
vector v_up
vector v_right
vector v_forward
#define gettagindex
string substring(string s, float start, float length)
float vlen(vector v)
vector
Definition self.qh:92
vector org
Definition self.qh:92

References AnglesTransform_FromAngles(), AnglesTransform_FromVAngles(), AnglesTransform_ToAngles(), AnglesTransform_ToVAngles(), entity(), fixedmakevectors(), fixedvectoangles2, gettagindex, gettaginfo, org, substring(), v_forward, v_right, v_up, vector, and vlen().

Referenced by follow_init().

◆ blink()

float blink ( float base,
float range,
float freq )

Definition at line 2178 of file util.qc.

2179{
2180 return blink_synced(base, range, freq, 0, 0);
2181}
ERASEABLE float blink_synced(float base, float range, float freq, float start_time, int start_pos)
Definition util.qc:2166
float freq
Definition pendulum.qc:3

References blink_synced(), and freq.

Referenced by DrawItemsTimeItem(), HUD_Get_Num_Color(), HUD_HealthArmor(), HUD_Mod_Keepaway(), HUD_Mod_KH(), HUD_Mod_TeamKeepaway(), and HUD_Radar_InputEvent().

◆ blink_synced()

float blink_synced ( float base,
float range,
float freq,
float start_time,
int start_blink )

Definition at line 2166 of file util.qc.

2167{
2168 // note:
2169 // RMS = sqrt(base^2 + 0.5 * range^2)
2170 // thus
2171 // base = sqrt(RMS^2 - 0.5 * range^2)
2172 // ensure RMS == 1
2173
2174 return base + range * sin((time - start_time - (M_PI / 2) * start_pos) * freq);
2175}
float time
#define M_PI
Definition mathlib.qh:108
float sin(float f)

References freq, M_PI, sin(), and time.

Referenced by blink(), and HUD_HealthArmor().

◆ CheckWireframeBox()

float CheckWireframeBox ( entity forent,
vector v0,
vector dvx,
vector dvy,
vector dvz )

Definition at line 582 of file util.qc.

583{
584 traceline(v0, v0 + dvx, true, forent); if(trace_fraction < 1) return 0;
585 traceline(v0, v0 + dvy, true, forent); if(trace_fraction < 1) return 0;
586 traceline(v0, v0 + dvz, true, forent); if(trace_fraction < 1) return 0;
587 traceline(v0 + dvx, v0 + dvx + dvy, true, forent); if(trace_fraction < 1) return 0;
588 traceline(v0 + dvx, v0 + dvx + dvz, true, forent); if(trace_fraction < 1) return 0;
589 traceline(v0 + dvy, v0 + dvy + dvx, true, forent); if(trace_fraction < 1) return 0;
590 traceline(v0 + dvy, v0 + dvy + dvz, true, forent); if(trace_fraction < 1) return 0;
591 traceline(v0 + dvz, v0 + dvz + dvx, true, forent); if(trace_fraction < 1) return 0;
592 traceline(v0 + dvz, v0 + dvz + dvy, true, forent); if(trace_fraction < 1) return 0;
593 traceline(v0 + dvx + dvy, v0 + dvx + dvy + dvz, true, forent); if(trace_fraction < 1) return 0;
594 traceline(v0 + dvx + dvz, v0 + dvx + dvy + dvz, true, forent); if(trace_fraction < 1) return 0;
595 traceline(v0 + dvy + dvz, v0 + dvx + dvy + dvz, true, forent); if(trace_fraction < 1) return 0;
596 return 1;
597}
float trace_fraction

References entity(), trace_fraction, and vector.

Referenced by Portal_Spawn(), and Porto_Draw().

◆ compressShortVector()

float compressShortVector ( vector vec)

Definition at line 521 of file util.qc.

522{
523 vector ang;
524 float p, y, len;
525 if(vec == '0 0 0')
526 return 0;
527 //print("compress: ", vtos(vec), "\n");
528 ang = vectoangles(vec);
529 ang.x = -ang.x;
530 if(ang.x < -90)
531 ang.x += 360;
532 if(ang.x < -90 && ang.x > +90)
533 error("BOGUS vectoangles");
534 //print("angles: ", vtos(ang), "\n");
535
536 p = floor(0.5 + (ang.x + 90) * (16 / 180)) & 15; // -90..90 to 0..14
537 if(p == 0)
538 {
539 if(vec.z < 0)
540 y = 31;
541 else
542 y = 30;
543 }
544 else
545 y = floor(0.5 + ang.y * (32 / 360)) & 31; // 0..360 to 0..32
546 len = invertLengthLog(vlen(vec));
547
548 //print("compressed: p:", ftos(p)); print(" y:", ftos(y)); print(" len:", ftos(len), "\n");
549
550 return (p * 0x1000) + (y * 0x80) + len;
551}
float invertLengthLog(float dist)
Definition util.qc:457
v y
Definition ent_cs.qc:121
vector vectoangles(vector v)
#define error
Definition pre.qh:6
vector vector ang
Definition self.qh:92

References ang, error, floor(), invertLengthLog(), vectoangles(), vector, vlen(), and y.

Referenced by pointparticles_SendEntity(), rainsnow_SendEntity(), SpawnCasing(), STATIC_INIT(), and Violence_GibSplash_At().

◆ compressShotOrigin()

float compressShotOrigin ( vector v)

Definition at line 1248 of file util.qc.

1249{
1250 int rx_neg = (v.x < 0) ? 1 : 0;
1251 int ry_neg = (v.y < 0) ? 1 : 0;
1252 int rz_neg = (v.z < 0) ? 1 : 0;
1253 int rx = rint(fabs(v.x) * 2);
1254 int ry = rint(fabs(v.y) * 2);
1255 int rz = rint(fabs(v.z) * 2);
1256 if(rx > 255) // 128 * 2 - 1
1257 {
1258 LOG_DEBUG("shot origin ", vtos(v), " x out of bounds\n");
1259 rx = bound(0, rx, 255);
1260 }
1261 if(ry > 63) // 32 * 2 - 1
1262 {
1263 LOG_DEBUG("shot origin ", vtos(v), " y out of bounds\n");
1264 ry = bound(0, ry, 63);
1265 }
1266 if(rz > 63) // 32 * 2 - 1
1267 {
1268 LOG_DEBUG("shot origin ", vtos(v), " z out of bounds\n");
1269 rz = bound(0, rz, 63);
1270 }
1271 ry |= ry_neg * BIT(6) + rx_neg * BIT(7);
1272 rz |= rz_neg * BIT(6); // BIT(7) unused
1273 return rx * 0x10000 + ry * 0x100 + rz;
1274}
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
#define LOG_DEBUG(...)
Definition log.qh:80
float bound(float min, float value, float max)
string vtos(vector v)
float rint(float f)
float fabs(float f)

References BIT, bound(), fabs(), LOG_DEBUG, rint(), vector, and vtos().

Referenced by CL_WeaponEntity_SetModel(), and ClientInit_misc().

◆ cvar_or()

float cvar_or ( string cv,
float v )

Definition at line 2150 of file util.qc.

2151{
2152 string s = cvar_string(cv);
2153 if(s == "")
2154 return v;
2155 else
2156 return stof(s);
2157}
float stof(string val,...)
const string cvar_string(string name)

References cvar_string(), and stof().

◆ cvar_settemp()

float cvar_settemp ( string pKey,
string pValue )

Definition at line 811 of file util.qc.

812{
813 float created_saved_value;
814
815 created_saved_value = 0;
816
817 if (!(tmp_cvar || tmp_value))
818 {
819 LOG_TRACE("Error: Invalid usage of cvar_settemp(string, string); !");
820 return 0;
821 }
822
823 if(!cvar_type(tmp_cvar))
824 {
825 LOG_INFOF("Error: cvar %s doesn't exist!", tmp_cvar);
826 return 0;
827 }
828
829 IL_EACH(g_saved_cvars, it.netname == tmp_cvar,
830 {
831 created_saved_value = -1; // skip creation
832 break; // no need to continue
833 });
834
835 if(created_saved_value != -1)
836 {
837 // creating a new entity to keep track of this cvar
838 entity e = new_pure(saved_cvar_value);
840 e.netname = strzone(tmp_cvar);
841 e.message = strzone(cvar_string(tmp_cvar));
842 created_saved_value = 1;
843 }
844
845 // update the cvar to the value given
846 cvar_set(tmp_cvar, tmp_value);
847
848 return created_saved_value;
849}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
IntrusiveList g_saved_cvars
Definition util.qh:33
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
#define LOG_TRACE(...)
Definition log.qh:76
#define LOG_INFOF(...)
Definition log.qh:66
void cvar_set(string name, string value)
string strzone(string s)
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67

References cvar_set(), cvar_string(), entity(), g_saved_cvars, IL_EACH, IL_PUSH(), LOG_INFOF, LOG_TRACE, new_pure, and strzone().

Referenced by _MapInfo_Parse_Settemp(), CampaignPreInit(), CSQC_Init(), CSQCPlayer_PostUpdate(), CSQCPlayer_Remove(), GameCommand_bot_cmd(), GameCommand_nospectators(), GameCommand_setbots(), GenericCommand_settemp(), NET_HANDLE(), NET_HANDLE(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), View_EventChase(), and View_Ortho().

◆ cvar_settemp_restore()

float cvar_settemp_restore ( )

Definition at line 851 of file util.qc.

852{
853 int j = 0;
854 // FIXME this new-style loop fails!
855#if 0
856 FOREACH_ENTITY_CLASS("saved_cvar_value", true,
857 {
858 if(cvar_type(it.netname))
859 {
860 cvar_set(it.netname, it.message);
861 strunzone(it.netname);
862 strunzone(it.message);
863 delete(it);
864 ++j;
865 }
866 else
867 LOG_INFOF("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.", it.netname);
868 });
869
870#else
871 entity e = NULL;
872 while((e = find(e, classname, "saved_cvar_value")))
873 {
874 if(cvar_type(e.netname))
875 {
876 cvar_set(e.netname, e.message);
877 delete(e);
878 ++j;
879 }
880 else
881 print(sprintf("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.", e.netname));
882 }
883#endif
884
885 return j;
886}
string classname
#define FOREACH_ENTITY_CLASS(class, cond, body)
Definition iter.qh:189
entity find(entity start,.string field, string match)
void strunzone(string s)
void print(string text,...)

References classname, cvar_set(), entity(), find(), FOREACH_ENTITY_CLASS, LOG_INFOF, NULL, print(), and strunzone().

Referenced by DoNextMapOverride(), GenericCommand_settemp_restore(), MapInfo_LoadMap(), and SV_Shutdown().

◆ decompressShortVector()

vector decompressShortVector ( float data)

References entity(), and vector.

◆ decompressShotOrigin()

vector decompressShotOrigin ( float f)

References vector.

◆ depthfirst()

void depthfirst ( entity start,
.entity up,
.entity downleft,
.entity right,
void(entity, entity) funcPre,
void(entity, entity) funcPost,
entity pass )

Definition at line 393 of file util.qc.

394{
395 entity e;
396 e = start;
397 funcPre(pass, e);
398 while (e.(downleft))
399 {
400 e = e.(downleft);
401 funcPre(pass, e);
402 }
403 funcPost(pass, e);
404 while(e != start)
405 {
406 if (e.(right))
407 {
408 e = e.(right);
409 funcPre(pass, e);
410 while (e.(downleft))
411 {
412 e = e.(downleft);
413 funcPre(pass, e);
414 }
415 }
416 else
417 e = e.(up);
418 funcPost(pass, e);
419 }
420}
#define pass(name, colormin, colormax)

References entity(), and pass.

Referenced by forAllDescendants().

◆ detach_sameorigin()

void detach_sameorigin ( entity e)

Definition at line 2000 of file util.qc.

2001{
2002 vector org;
2003 org = gettaginfo(e, 0);
2004 e.angles = fixedvectoangles2(v_forward, v_up);
2005 if (substring(e.model, 0, 1) == "*") // bmodels have their own rules
2006 e.angles = AnglesTransform_ToVAngles(e.angles);
2007 else
2008 e.angles = AnglesTransform_ToAngles(e.angles);
2009 setorigin(e, org);
2010 setattachment(e, NULL, "");
2011 setorigin(e, e.origin);
2012}

References AnglesTransform_ToAngles(), AnglesTransform_ToVAngles(), entity(), fixedvectoangles2, gettaginfo, NULL, org, substring(), v_forward, v_up, and vector.

Referenced by Drag().

◆ execute_next_frame()

void execute_next_frame ( )

Definition at line 1748 of file util.qc.

1749{
1751 {
1752 localcmd("\n", to_execute_next_frame, "\n");
1754 }
1755}
string to_execute_next_frame
Definition util.qc:1747
void localcmd(string command,...)
#define strfree(this)
Definition string.qh:59

References localcmd(), strfree, and to_execute_next_frame.

Referenced by CSQC_UpdateView(), m_draw(), and StartFrame().

◆ find_last_color_code()

string find_last_color_code ( string s)

Definition at line 960 of file util.qc.

961{
962 int start = strstrofs(s, "^", 0);
963 if (start == -1) // no caret found
964 return "";
965 int len = strlen(s)-1;
966 for(int i = len; i >= start; --i)
967 {
968 if(substring(s, i, 1) != "^")
969 continue;
970
971 int carets = 1;
972 while (i-carets >= start && substring(s, i-carets, 1) == "^")
973 ++carets;
974
975 // check if carets aren't all escaped
976 if (carets & 1)
977 {
978 if(i+1 <= len)
979 if(IS_DIGIT(substring(s, i+1, 1)))
980 return substring(s, i, 2);
981
982 if(i+4 <= len)
983 if(substring(s, i+1, 1) == "x")
984 if(IS_HEXDIGIT(substring(s, i + 2, 1)))
985 if(IS_HEXDIGIT(substring(s, i + 3, 1)))
986 if(IS_HEXDIGIT(substring(s, i + 4, 1)))
987 return substring(s, i, 5);
988 }
989 i -= carets; // this also skips one char before the carets
990 }
991
992 return "";
993}
#define strstrofs
#define strlen
#define IS_DIGIT(d)
Definition string.qh:576
#define IS_HEXDIGIT(d)
Definition string.qh:573

References IS_DIGIT, IS_HEXDIGIT, strlen, strstrofs, and substring().

Referenced by getWrappedLine(), getWrappedLineLen(), hash_replace(), and minigame_getWrappedLine().

◆ findbetterlocation()

vector findbetterlocation ( vector org,
float mindist )

Definition at line 117 of file util.qc.

118{
119 vector vec = mindist * '1 0 0';
120 int c = 0;
121 while (c < 6)
122 {
123 traceline (org, org + vec, true, NULL);
124 vec = vec * -1;
125 if (trace_fraction < 1)
126 {
127 vector loc = trace_endpos;
128 traceline (loc, loc + vec, true, NULL);
129 if (trace_fraction >= 1)
130 org = loc + vec;
131 }
132 if (c & 1)
133 {
134 float h = vec.y;
135 vec.y = vec.x;
136 vec.x = vec.z;
137 vec.z = h;
138 }
139 c = c + 1;
140 }
141
142 return org;
143}
vector trace_endpos

References NULL, org, trace_endpos, trace_fraction, and vector.

Referenced by nade_boom(), and W_Seeker_Tag_Touch().

◆ FindConnectedComponent()

void FindConnectedComponent ( entity e,
.entity fld,
findNextEntityNearFunction_t nxt,
isConnectedFunction_t iscon,
entity pass )

Definition at line 1766 of file util.qc.

1767{
1768 entity queue_start, queue_end;
1769
1770 // we build a queue of to-be-processed entities.
1771 // queue_start is the next entity to be checked for neighbors
1772 // queue_end is the last entity added
1773
1774 if(e.FindConnectedComponent_processing)
1775 error("recursion or broken cleanup");
1776
1777 // start with a 1-element queue
1778 queue_start = queue_end = e;
1779 queue_end.(fld) = NULL;
1780 queue_end.FindConnectedComponent_processing = 1;
1781
1782 // for each queued item:
1783 for (; queue_start; queue_start = queue_start.(fld))
1784 {
1785 // find all neighbors of queue_start
1786 entity t;
1787 for(t = NULL; (t = nxt(t, queue_start, pass)); )
1788 {
1789 if(t.FindConnectedComponent_processing)
1790 continue;
1791 if(iscon(t, queue_start, pass))
1792 {
1793 // it is connected? ADD IT. It will look for neighbors soon too.
1794 queue_end.(fld) = t;
1795 queue_end = t;
1796 queue_end.(fld) = NULL;
1797 queue_end.FindConnectedComponent_processing = 1;
1798 }
1799 }
1800 }
1801
1802 // unmark
1803 for (queue_start = e; queue_start; queue_start = queue_start.(fld))
1804 queue_start.FindConnectedComponent_processing = 0;
1805}

References entity(), error, NULL, and pass.

Referenced by LinkDoors().

◆ fixPriorityList()

string fixPriorityList ( string pl,
float from,
float to,
float subtract,
float complete )

Definition at line 600 of file util.qc.

601{
602 string neworder;
603 float i, n, w;
604
605 n = tokenize_console(order);
606 neworder = "";
607 for(i = 0; i < n; ++i)
608 {
609 w = stof(argv(i));
610 if(w == floor(w))
611 {
612 if(w >= from && w <= to)
613 neworder = strcat(neworder, ftos(w), " ");
614 else
615 {
616 w -= subtract;
617 if(w >= from && w <= to)
618 neworder = strcat(neworder, ftos(w), " ");
619 }
620 }
621 }
622
623 if(complete)
624 {
625 n = tokenize_console(neworder);
626 for(w = to; w >= from; --w)
627 {
628 int wflags = REGISTRY_GET(Weapons, w).spawnflags;
629 if(wflags & WEP_FLAG_SPECIALATTACK)
630 continue;
631 for(i = 0; i < n; ++i)
632 if(stof(argv(i)) == w)
633 break;
634 if(i == n) // not found
635 neworder = strcat(neworder, ftos(w), " ");
636 }
637 }
638
639 return substring(neworder, 0, strlen(neworder) - 1);
640}
#define tokenize_console
Weapons
Definition guide.qh:113
string ftos(float f)
string argv(float n)
#define REGISTRY_GET(id, i)
Definition registry.qh:43
const int WEP_FLAG_SPECIALATTACK
Definition weapon.qh:227

References argv(), floor(), ftos(), REGISTRY_GET, stof(), strcat(), strlen, substring(), tokenize_console, Weapons, and WEP_FLAG_SPECIALATTACK.

Referenced by W_FixWeaponOrder().

◆ follow_sameorigin()

void follow_sameorigin ( entity e,
entity to )

Definition at line 2014 of file util.qc.

2015{
2016 set_movetype(e, MOVETYPE_FOLLOW); // make the hole follow
2017 e.aiment = to; // make the hole follow bmodel
2018 e.punchangle = to.angles; // the original angles of bmodel
2019 e.view_ofs = e.origin - to.origin; // relative origin
2020 e.v_angle = e.angles - to.angles; // relative angles
2021}
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_FOLLOW
Definition movetypes.qh:141

References entity(), MOVETYPE_FOLLOW, and set_movetype().

Referenced by follow_init().

◆ get_mi_min_max()

void get_mi_min_max ( float mode)

Definition at line 678 of file util.qc.

679{
680 vector mi, ma;
681
682 string s = mapname;
683 if(!strcasecmp(substring(s, 0, 5), "maps/"))
684 s = substring(s, 5, strlen(s) - 5);
685 if(!strcasecmp(substring(s, strlen(s) - 4, 4), ".bsp"))
686 s = substring(s, 0, strlen(s) - 4);
688
689#ifdef CSQC
690 mi = world.mins;
691 ma = world.maxs;
692#else
693 mi = world.absmin;
694 ma = world.absmax;
695#endif
696
697 mi_min = mi;
698 mi_max = ma;
701 {
704 }
705 else
706 {
707 // not specified
708 if(mode)
709 {
710 // be clever
711 tracebox('1 0 0' * mi.x,
712 '0 1 0' * mi.y + '0 0 1' * mi.z,
713 '0 1 0' * ma.y + '0 0 1' * ma.z,
714 '1 0 0' * ma.x,
716 NULL);
718 mi_min.x = trace_endpos.x;
719
720 tracebox('0 1 0' * mi.y,
721 '1 0 0' * mi.x + '0 0 1' * mi.z,
722 '1 0 0' * ma.x + '0 0 1' * ma.z,
723 '0 1 0' * ma.y,
725 NULL);
727 mi_min.y = trace_endpos.y;
728
729 tracebox('0 0 1' * mi.z,
730 '1 0 0' * mi.x + '0 1 0' * mi.y,
731 '1 0 0' * ma.x + '0 1 0' * ma.y,
732 '0 0 1' * ma.z,
734 NULL);
736 mi_min.z = trace_endpos.z;
737
738 tracebox('1 0 0' * ma.x,
739 '0 1 0' * mi.y + '0 0 1' * mi.z,
740 '0 1 0' * ma.y + '0 0 1' * ma.z,
741 '1 0 0' * mi.x,
743 NULL);
745 mi_max.x = trace_endpos.x;
746
747 tracebox('0 1 0' * ma.y,
748 '1 0 0' * mi.x + '0 0 1' * mi.z,
749 '1 0 0' * ma.x + '0 0 1' * ma.z,
750 '0 1 0' * mi.y,
752 NULL);
754 mi_max.y = trace_endpos.y;
755
756 tracebox('0 0 1' * ma.z,
757 '1 0 0' * mi.x + '0 1 0' * mi.y,
758 '1 0 0' * ma.x + '0 1 0' * ma.y,
759 '0 0 1' * mi.z,
761 NULL);
763 mi_max.z = trace_endpos.z;
764 }
765 }
766}
string mi_shortname
Definition util.qh:126
vector mi_min
Definition util.qh:127
vector mi_max
Definition util.qh:128
string mapname
float trace_startsolid
float MOVE_WORLDONLY
#define strcasecmp
int MapInfo_Get_ByName(string pFilename, float pAllowGenerate, Gametype pGametypeToSet)
Definition mapinfo.qc:1390
vector MapInfo_Map_maxs
Definition mapinfo.qh:17
vector MapInfo_Map_mins
Definition mapinfo.qh:16
#define world
Definition post.qh:15
#define strcpy(this, s)
Definition string.qh:52

References MapInfo_Get_ByName(), MapInfo_Map_maxs, MapInfo_Map_mins, mapname, mi_max, mi_min, mi_shortname, MOVE_WORLDONLY, NULL, strcasecmp, strcpy, strlen, substring(), trace_endpos, trace_startsolid, vector, and world.

Referenced by get_mi_min_max_texcoords(), and InitGameplayMode().

◆ get_mi_min_max_texcoords()

void get_mi_min_max_texcoords ( float mode)

Definition at line 768 of file util.qc.

769{
770 vector extend;
771
772 get_mi_min_max(mode);
773
776
777 // extend mi_picmax to get a square aspect ratio
778 // center the map in that area
779 extend = mi_picmax - mi_picmin;
780 if(extend.y > extend.x)
781 {
782 mi_picmin.x -= (extend.y - extend.x) * 0.5;
783 mi_picmax.x += (extend.y - extend.x) * 0.5;
784 }
785 else
786 {
787 mi_picmin.y -= (extend.x - extend.y) * 0.5;
788 mi_picmax.y += (extend.x - extend.y) * 0.5;
789 }
790
791 // add another some percent
792 extend = (mi_picmax - mi_picmin) * (1 / 64.0);
793 mi_picmin -= extend;
794 mi_picmax += extend;
795
796 // calculate the texcoords
798 // first the two corners of the origin
799 mi_pictexcoord0_x = (mi_min.x - mi_picmin.x) / (mi_picmax.x - mi_picmin.x);
800 mi_pictexcoord0_y = (mi_min.y - mi_picmin.y) / (mi_picmax.y - mi_picmin.y);
801 mi_pictexcoord2_x = (mi_max.x - mi_picmin.x) / (mi_picmax.x - mi_picmin.x);
802 mi_pictexcoord2_y = (mi_max.y - mi_picmin.y) / (mi_picmax.y - mi_picmin.y);
803 // then the other corners
804 mi_pictexcoord1_x = mi_pictexcoord0_x;
805 mi_pictexcoord1_y = mi_pictexcoord2_y;
806 mi_pictexcoord3_x = mi_pictexcoord2_x;
807 mi_pictexcoord3_y = mi_pictexcoord0_y;
808}
void get_mi_min_max(float mode)
Definition util.qc:678
vector mi_picmin
Definition util.qh:131
vector mi_pictexcoord2
Definition util.qh:135
vector mi_pictexcoord3
Definition util.qh:136
vector mi_pictexcoord0
Definition util.qh:133
vector mi_picmax
Definition util.qh:132
vector mi_pictexcoord1
Definition util.qh:134

References get_mi_min_max(), mi_max, mi_min, mi_picmax, mi_picmin, mi_pictexcoord0, mi_pictexcoord1, mi_pictexcoord2, mi_pictexcoord3, and vector.

Referenced by CSQC_Init().

◆ get_model_datafilename()

string get_model_datafilename ( string mod,
float skn,
string fil )

Definition at line 1381 of file util.qc.

1382{
1383 if(m)
1384 m = strcat(m, "_");
1385 else
1386 m = "models/player/*_";
1387 if(sk >= 0)
1388 m = strcat(m, ftos(sk));
1389 else
1390 m = strcat(m, "*");
1391 return strcat(m, ".", fil);
1392}

References ftos(), and strcat().

Referenced by get_model_parameters(), UpdatePlayerSounds(), and XonoticPlayerModelSelector_loadModels().

◆ get_model_parameters()

float get_model_parameters ( string mod,
float skn )

Definition at line 1394 of file util.qc.

1395{
1406 for(int i = 0; i < MAX_AIM_BONES; ++i)
1407 {
1410 }
1413
1414#ifdef GAMEQC
1415 MUTATOR_CALLHOOK(ClearModelParams);
1416#endif
1417
1418 if (!m)
1419 return 1;
1420
1421 if(substring(m, -9, 5) == "_lod1" || substring(m, -9, 5) == "_lod2")
1422 m = strcat(substring(m, 0, -10), substring(m, -4, -1));
1423
1424 if(sk < 0)
1425 {
1426 if(substring(m, -4, -1) != ".txt")
1427 return 0;
1428 if(substring(m, -6, 1) != "_")
1429 return 0;
1430 sk = stof(substring(m, -5, 1));
1431 m = substring(m, 0, -7);
1432 }
1433
1434 string fn = get_model_datafilename(m, sk, "txt");
1435 int fh = fopen(fn, FILE_READ);
1436 if(fh < 0)
1437 {
1438 sk = 0;
1439 fn = get_model_datafilename(m, sk, "txt");
1440 fh = fopen(fn, FILE_READ);
1441 if(fh < 0)
1442 return 0;
1443 }
1444
1447 string s, c;
1448 while((s = fgets(fh)))
1449 {
1450 if(s == "")
1451 break; // next lines will be description
1452 c = car(s);
1453 s = cdr(s);
1454 if(c == "name")
1456 if(c == "species")
1457 switch(s)
1458 {
1459 case "human": get_model_parameters_species = SPECIES_HUMAN; break;
1460 case "alien": get_model_parameters_species = SPECIES_ALIEN; break;
1461 case "robot_shiny": get_model_parameters_species = SPECIES_ROBOT_SHINY; break;
1462 case "robot_rusty": get_model_parameters_species = SPECIES_ROBOT_RUSTY; break;
1463 case "robot_solid": get_model_parameters_species = SPECIES_ROBOT_SOLID; break;
1464 case "animal": get_model_parameters_species = SPECIES_ANIMAL; break;
1465 case "reserved": get_model_parameters_species = SPECIES_RESERVED; break;
1466 }
1467 if(c == "sex")
1468 {
1469 if (s == "Male") s = _("Male");
1470 else if (s == "Female") s = _("Female");
1471 else if (s == "Undisclosed") s = _("Undisclosed");
1473 }
1474 if(c == "weight")
1476 if(c == "age")
1478 if(c == "description")
1480 if(c == "bone_upperbody")
1482 if(c == "bone_weapon")
1484 #ifdef GAMEQC
1485 MUTATOR_CALLHOOK(GetModelParams, c, s);
1486 #endif
1487 for(int i = 0; i < MAX_AIM_BONES; ++i)
1488 if(c == strcat("bone_aim", ftos(i)))
1489 {
1492 }
1493 if(c == "fixbone")
1495 if(c == "hidden")
1497 }
1498
1499 while((s = fgets(fh)))
1500 {
1503 if(s != "")
1505 }
1506
1507 fclose(fh);
1508
1509 return 1;
1510}
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
string get_model_datafilename(string m, float sk, string fil)
Definition util.qc:1381
const int MAX_AIM_BONES
Definition util.qh:188
float get_model_parameters_weight
Definition util.qh:182
float get_model_parameters_fixbone
Definition util.qh:191
string get_model_parameters_sex
Definition util.qh:181
float get_model_parameters_species
Definition util.qh:180
float get_model_parameters_bone_aimweight[MAX_AIM_BONES]
Definition util.qh:190
float get_model_parameters_modelskin
Definition util.qh:178
string get_model_parameters_name
Definition util.qh:179
string get_model_parameters_bone_weapon
Definition util.qh:187
string get_model_parameters_description
Definition util.qh:185
bool get_model_parameters_hidden
Definition util.qh:184
string get_model_parameters_modelname
Definition util.qh:177
string get_model_parameters_bone_upperbody
Definition util.qh:186
string get_model_parameters_bone_aim[MAX_AIM_BONES]
Definition util.qh:189
float get_model_parameters_age
Definition util.qh:183
string get_model_parameters_desc
Definition util.qh:192
const int SPECIES_ANIMAL
Definition constants.qh:25
const int SPECIES_ROBOT_SOLID
Definition constants.qh:23
const int SPECIES_ROBOT_RUSTY
Definition constants.qh:26
const int SPECIES_RESERVED
Definition constants.qh:28
const int SPECIES_ROBOT_SHINY
Definition constants.qh:27
const int SPECIES_ALIEN
Definition constants.qh:24
const int SPECIES_HUMAN
Definition constants.qh:22
const float FILE_READ
#define stob(s)
Definition int.qh:5
string fgets(float fhandle)
void fclose(float fhandle)
float fopen(string filename, float mode)
string string_null
Definition nil.qh:9
ERASEABLE string car(string s)
returns first word
Definition string.qh:259
ERASEABLE string cdr(string s)
returns all but first word
Definition string.qh:268

References car(), cdr(), fclose(), fgets(), FILE_READ, fopen(), ftos(), get_model_datafilename(), get_model_parameters_age, get_model_parameters_bone_aim, get_model_parameters_bone_aimweight, get_model_parameters_bone_upperbody, get_model_parameters_bone_weapon, get_model_parameters_desc, get_model_parameters_description, get_model_parameters_fixbone, get_model_parameters_hidden, get_model_parameters_modelname, get_model_parameters_modelskin, get_model_parameters_name, get_model_parameters_sex, get_model_parameters_species, get_model_parameters_weight, MAX_AIM_BONES, MUTATOR_CALLHOOK, SPECIES_ALIEN, SPECIES_ANIMAL, SPECIES_HUMAN, SPECIES_RESERVED, SPECIES_ROBOT_RUSTY, SPECIES_ROBOT_SHINY, SPECIES_ROBOT_SOLID, stob, stof(), strcat(), string_null, and substring().

Referenced by player_getspecies(), skeleton_loadinfo(), and XonoticPlayerModelSelector_loadModels().

◆ get_shotvelocity()

vector get_shotvelocity ( vector myvel,
vector mydir,
float spd,
float newton_style,
float mi,
float ma )

Definition at line 1196 of file util.qc.

1197{
1198 if(!newton_style)
1199 return spd * mydir;
1200
1201 if(newton_style == 2)
1202 {
1203 // true Newtonian projectiles with automatic aim adjustment
1204 //
1205 // solve: |outspeed * mydir - myvel| = spd
1206 // outspeed^2 - 2 * outspeed * (mydir * myvel) + myvel^2 - spd^2 = 0
1207 // outspeed = (mydir * myvel) +- sqrt((mydir * myvel)^2 - myvel^2 + spd^2)
1208 // PLUS SIGN!
1209 // not defined?
1210 // then...
1211 // myvel^2 - (mydir * myvel)^2 > spd^2
1212 // velocity without mydir component > spd
1213 // fire at smallest possible spd that works?
1214 // |(mydir * myvel) * myvel - myvel| = spd
1215
1216 vector solution = solve_quadratic(1, -2 * (mydir * myvel), myvel * myvel - spd * spd);
1217
1218 float outspeed;
1219 if(solution.z)
1220 outspeed = solution.y; // the larger one
1221 else
1222 {
1223 //outspeed = 0; // slowest possible shot
1224 outspeed = solution.x; // the real part (that is, the average!)
1225 //dprint("impossible shot, adjusting\n");
1226 }
1227
1228 outspeed = bound(spd * mi, outspeed, spd * ma);
1229 return mydir * outspeed;
1230 }
1231
1232 // real Newtonian
1233 return myvel + spd * mydir;
1234}
ERASEABLE vector solve_quadratic(float a, float b, float c)
ax^2 + bx + c = 0
Definition math.qh:304

References bound(), solve_quadratic(), and vector.

Referenced by W_CalculateProjectileVelocity().

◆ getcurrentmod()

string getcurrentmod ( )

Definition at line 1327 of file util.qc.

1328{
1329 float n;
1330 string m;
1331 m = cvar_string("fs_gamedir");
1332 n = tokenize_console(m);
1333 if(n == 0)
1334 return "data";
1335 else
1336 return argv(n - 1);
1337}

References argv(), cvar_string(), and tokenize_console.

Referenced by resolvemod().

◆ getWrappedLine()

string getWrappedLine ( float w,
vector size,
textLengthUpToWidth_widthFunction_t tw )

Definition at line 995 of file util.qc.

996{
997 string s = getWrappedLine_remaining;
998
999 if(maxWidth <= 0)
1000 {
1002 return s; // the line has no size ANYWAY, nothing would be displayed.
1003 }
1004
1005 int take_until = textLengthUpToWidth(s, maxWidth, theFontSize, tw);
1006 if(take_until > 0 && take_until < strlen(s))
1007 {
1008 int last_word = take_until - 1;
1009 while(last_word > 0 && substring(s, last_word, 1) != " ")
1010 --last_word;
1011
1012 int skip = 0;
1013 if(last_word != 0)
1014 {
1015 take_until = last_word;
1016 skip = 1;
1017 }
1018
1019 getWrappedLine_remaining = substring(s, take_until + skip, strlen(s) - take_until);
1020 if(getWrappedLine_remaining == "")
1022 else if (tw("^7", theFontSize) == 0)
1024 return substring(s, 0, take_until);
1025 }
1026 else
1027 {
1029 return s;
1030 }
1031}
string find_last_color_code(string s)
Definition util.qc:960
float textLengthUpToWidth(string theText, float maxWidth, vector theSize, textLengthUpToWidth_widthFunction_t w)
Definition util.qc:888
string getWrappedLine_remaining
Definition util.qh:147

References find_last_color_code(), getWrappedLine_remaining, strcat(), string_null, strlen, substring(), textLengthUpToWidth(), and vector.

Referenced by Checkpoints_drawstring(), GameTypeVote_DrawGameTypeItem(), HUD_CenterPrint(), InfoMessages_drawstring(), Label_draw(), Label_recalcPositionWithText(), m_tooltip(), rewrapCampaign(), wrapGuideText(), XonoticEntryList_drawListBoxItem(), and XonoticTextBox_setText().

◆ getWrappedLineLen()

string getWrappedLineLen ( float w,
textLengthUpToLength_lenFunction_t tw )

◆ healtharmor_applydamage()

vector healtharmor_applydamage ( float a,
float armorblock,
int deathtype,
float damage )

Definition at line 1313 of file util.qc.

1314{
1315 vector v;
1316 if (DEATH_IS(deathtype, DEATH_DROWN)) // Why should armor help here...
1317 armorblock = 0;
1318 if (deathtype & HITTYPE_ARMORPIERCE)
1319 armorblock = 0;
1320 v.y = bound(0, damage * armorblock, a); // save
1321 v.x = bound(0, damage - v.y, damage); // take
1322 v.z = 0;
1323 return v;
1324}
const int HITTYPE_ARMORPIERCE
Definition all.qh:32
#define DEATH_IS(t, dt)
Definition all.qh:40

References bound(), DEATH_IS, HITTYPE_ARMORPIERCE, and vector.

Referenced by Damage(), Monster_Damage(), PlayerCorpseDamage(), and PlayerDamage().

◆ healtharmor_maxdamage()

vector healtharmor_maxdamage ( float h,
float a,
float armorblock,
int deathtype )

Definition at line 1289 of file util.qc.

1290{
1291 // NOTE: we'll always choose the SMALLER value...
1292 float healthdamage, armordamage, armorideal;
1293 if (DEATH_IS(deathtype, DEATH_DROWN)) // Why should armor help here...
1294 armorblock = 0;
1295 vector v;
1296 healthdamage = (h - 1) / (1 - armorblock); // damage we can take if we could use more health
1297 armordamage = a + (h - 1); // damage we can take if we could use more armor
1298 armorideal = healthdamage * armorblock;
1299 v.y = armorideal;
1300 if(armordamage < healthdamage)
1301 {
1302 v.x = armordamage;
1303 v.z = 1;
1304 }
1305 else
1306 {
1307 v.x = healthdamage;
1308 v.z = 0;
1309 }
1310 return v;
1311}

References DEATH_IS, and vector.

Referenced by crosshair_getcolor(), ctf_FlagcarrierWaypoints(), HUD_HealthArmor(), if(), and WaypointSprite_AttachCarrier().

◆ isGametypeInFilter()

float isGametypeInFilter ( entity gt,
float tp,
float ts,
string pattern )

References entity(), and vector.

◆ LostMovetypeFollow()

int LostMovetypeFollow ( entity ent)

Definition at line 2063 of file util.qc.

2064{
2065/*
2066 if(ent.move_movetype != MOVETYPE_FOLLOW)
2067 if(ent.aiment)
2068 error("???");
2069*/
2070 // FIXME: engine bug?
2071 // when aiment disconnects the engine will set orb's origin close to world's origin
2072 if(!ent.aiment)
2073 return 2;
2074 if(ent.aiment.classname != ent.aiment_classname || ent.aiment.deadflag != ent.aiment_deadflag)
2075 return 1;
2076 return 0;
2077}

References entity().

Referenced by GrapplingHookThink(), W_Electro_Orb_Follow_Think(), and W_MineLayer_Think().

◆ mapPriorityList()

string mapPriorityList ( string order,
string(string) mapfunc )

Definition at line 642 of file util.qc.

643{
644 string neworder;
645 float n;
646
647 n = tokenize_console(order);
648 neworder = "";
649 for(float i = 0; i < n; ++i)
650 neworder = strcat(neworder, mapfunc(argv(i)), " ");
651
652 return substring(neworder, 0, strlen(neworder) - 1);
653}

References argv(), strcat(), strlen, substring(), and tokenize_console.

Referenced by W_NameWeaponOrder(), and W_NumberWeaponOrder().

◆ matchacl()

float matchacl ( string acl,
string str )

Definition at line 1339 of file util.qc.

1340{
1341 string t, s;
1342 float r, d;
1343 r = 0;
1344 while(acl)
1345 {
1346 t = car(acl); acl = cdr(acl);
1347
1348 d = 1;
1349 if(substring(t, 0, 1) == "-")
1350 {
1351 d = -1;
1352 t = substring(t, 1, strlen(t) - 1);
1353 }
1354 else if(substring(t, 0, 1) == "+")
1355 t = substring(t, 1, strlen(t) - 1);
1356
1357 if(substring(t, -1, 1) == "*")
1358 {
1359 t = substring(t, 0, strlen(t) - 1);
1360 s = substring(str, 0, strlen(t));
1361 }
1362 else
1363 s = str;
1364
1365 if(s == t)
1366 {
1367 r = d;
1368 break; // if we found a killing case, apply it! other settings may be allowed in the future, but this one is caught
1369 }
1370 }
1371 return r;
1372}

References car(), cdr(), strlen, and substring().

Referenced by _MapInfo_Parse_Settemp().

◆ Mod_Q1BSP_NativeContentsFromSuperContents()

int Mod_Q1BSP_NativeContentsFromSuperContents ( int supercontents)

Definition at line 1943 of file util.qc.

1944{
1945 if(supercontents & (DPCONTENTS_SOLID | DPCONTENTS_BODY))
1946 return CONTENT_SOLID;
1947 if(supercontents & DPCONTENTS_SKY)
1948 return CONTENT_SKY;
1949 if(supercontents & DPCONTENTS_LAVA)
1950 return CONTENT_LAVA;
1951 if(supercontents & DPCONTENTS_SLIME)
1952 return CONTENT_SLIME;
1953 if(supercontents & DPCONTENTS_WATER)
1954 return CONTENT_WATER;
1955 return CONTENT_EMPTY;
1956}
float DPCONTENTS_SKY
const float CONTENT_SKY
float DPCONTENTS_SOLID
const float CONTENT_SOLID
float DPCONTENTS_BODY
const float CONTENT_WATER
float DPCONTENTS_SLIME
float DPCONTENTS_LAVA
const float CONTENT_LAVA
float DPCONTENTS_WATER
const float CONTENT_EMPTY
const float CONTENT_SLIME

References CONTENT_EMPTY, CONTENT_LAVA, CONTENT_SKY, CONTENT_SLIME, CONTENT_SOLID, CONTENT_WATER, DPCONTENTS_BODY, DPCONTENTS_LAVA, DPCONTENTS_SKY, DPCONTENTS_SLIME, DPCONTENTS_SOLID, and DPCONTENTS_WATER.

◆ Mod_Q1BSP_SuperContentsFromNativeContents()

int Mod_Q1BSP_SuperContentsFromNativeContents ( int nativecontents)

Definition at line 1923 of file util.qc.

1924{
1925 switch(nativecontents)
1926 {
1927 case CONTENT_EMPTY:
1928 return 0;
1929 case CONTENT_SOLID:
1931 case CONTENT_WATER:
1932 return DPCONTENTS_WATER;
1933 case CONTENT_SLIME:
1934 return DPCONTENTS_SLIME;
1935 case CONTENT_LAVA:
1937 case CONTENT_SKY:
1938 return DPCONTENTS_SKY | DPCONTENTS_NODROP | DPCONTENTS_OPAQUE; // to match behaviour of Q3 maps, let sky count as opaque
1939 }
1940 return 0;
1941}
float DPCONTENTS_NODROP
float DPCONTENTS_OPAQUE

References CONTENT_EMPTY, CONTENT_LAVA, CONTENT_SKY, CONTENT_SLIME, CONTENT_SOLID, CONTENT_WATER, DPCONTENTS_LAVA, DPCONTENTS_NODROP, DPCONTENTS_OPAQUE, DPCONTENTS_SKY, DPCONTENTS_SLIME, DPCONTENTS_SOLID, and DPCONTENTS_WATER.

Referenced by _Movetype_CheckWater(), and racer_frame().

◆ playername()

string playername ( string thename,
int teamid,
bool team_colorize )

Definition at line 2082 of file util.qc.

2083{
2084 TC(int, teamid);
2085 bool do_colorize = (teamplay && team_colorize);
2086#ifdef SVQC
2087 if(do_colorize && !intermission_running)
2088#else
2089 if(do_colorize)
2090#endif
2091 {
2092 string t = Team_ColorCode(teamid);
2093 return strcat(t, strdecolorize(thename));
2094 }
2095 else
2096 return thename;
2097}
bool intermission_running
#define TC(T, sym)
Definition _all.inc:82
bool teamplay
Definition teams.qh:59
string Team_ColorCode(int teamid)
Definition teams.qh:63

References intermission_running, strcat(), TC, Team_ColorCode(), and teamplay.

Referenced by CheatsAllowed(), ClientCommand_ready(), ClientConnect(), Draw_ShowNames(), DumpStats(), GameCommand_adminmsg(), GameCommand_defer_clear(), GameCommand_moveplayer(), GetCallerName(), MatchEnd_RestoreSpectatorAndTeamStatus(), NextLevel(), OriginalCallerName(), PlayerFrame(), PlayerStats_GameReport_FinalizePlayer(), Remove_Countdown(), Say(), Score_NicePrint_Player(), Score_NicePrint_Spectator(), TeamBalance_RemoveExcessPlayers(), and W_HitPlotOpen().

◆ queue_to_execute_next_frame()

void queue_to_execute_next_frame ( string s)

Definition at line 1756 of file util.qc.

1757{
1759 {
1760 s = strcat(s, "\n", to_execute_next_frame);
1761 }
1763}

References strcat(), strcpy, and to_execute_next_frame.

Referenced by GenericCommand_nextframe().

◆ real_origin()

vector real_origin ( entity ent)

Definition at line 148 of file util.qc.

149{
150 vector v = ((ent.absmin + ent.absmax) * 0.5);
151 entity e = ent.tag_entity;
152
153 while(e)
154 {
155 v = v + ((e.absmin + e.absmax) * 0.5);
156 e = e.tag_entity;
157 }
158
159 return v;
160}

References entity(), and vector.

Referenced by bumblebee_gunner_exit(), bumblebee_gunner_frame(), bumblebee_pilot_frame(), racer_frame(), raptor_frame(), turret_aim_generic(), turret_do_updates(), turret_targetscore_generic(), turret_validate_target(), and vehicles_damage().

◆ ScoreString()

string ScoreString ( float vflags,
float value,
int rounds_played )

References rounds_played.

◆ SetMovetypeFollow()

void SetMovetypeFollow ( entity ent,
entity e )

Definition at line 2033 of file util.qc.

2034{
2035 set_movetype(ent, MOVETYPE_FOLLOW); // make the hole follow
2036 ent.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid - this means this cannot be teleported by warpzones any more! Instead, we must notice when our owner gets teleported.
2037 ent.aiment = e; // make the hole follow bmodel
2038 ent.punchangle = e.angles; // the original angles of bmodel
2039 ent.view_ofs = ent.origin - e.origin; // relative origin
2040 ent.v_angle = ent.angles - e.angles; // relative angles
2041 ent.aiment_classname = e.classname;
2042 ent.aiment_deadflag = e.deadflag;
2043
2044 if(IS_PLAYER(ent.aiment))
2045 {
2046 entity pl = ent.aiment;
2047 ent.view_ofs.x = bound(pl.mins.x + 4, ent.view_ofs.x, pl.maxs.x - 4);
2048 ent.view_ofs.y = bound(pl.mins.y + 4, ent.view_ofs.y, pl.maxs.y - 4);
2049 ent.view_ofs.z = bound(pl.mins.z + 4, ent.view_ofs.z, pl.maxs.z - 4);
2050 }
2051}
#define IS_PLAYER(s)
Definition player.qh:243
const float SOLID_NOT

References bound(), entity(), IS_PLAYER, MOVETYPE_FOLLOW, set_movetype(), and SOLID_NOT.

Referenced by GrapplingHookTouch(), W_Electro_Orb_Stick(), and W_MineLayer_Stick().

◆ Shutdown()

void Shutdown ( )

Definition at line 162 of file main.qc.

163{
165
166 delete(teams);
167 delete(players);
171 db_dump(ClientProgsDB, "client.db");
172 else
173 db_save(ClientProgsDB, "client.db");
175
176 if(camera_active)
177 cvar_set("chase_active",ftos(chase_active_backup));
178
179 // unset the event chasecam's chase_active
181 cvar_set("chase_active", "0");
182
184 cvar_set("r_drawviewmodel", "0");
185
186 cvar_set("slowmo", cvar_defstring("slowmo")); // reset it back to 'default'
187
188 // if _cl_hook_gamestart wasn't called with an actual gametype
189 // before CSQC VM shutdown then call it with nop fallback here
190 if (!(calledhooks & HOOK_START) && !isdemo())
191 localcmd("\n_cl_hook_gamestart nop\n");
192
193 // fire game or demo end hooks when CSQC VM shuts down
194 if (!(calledhooks & HOOK_END))
195 {
196 // call gameend hook if it hasn't somehow yet fired by intermission starting
197 if (!isdemo())
198 {
199 localcmd("\ncl_hook_gameend\n");
200
201 // NOTE: using localcmd here to ensure it's executed AFTER cl_hook_gameend
202 // earlier versions of the game abuse the hook to set this cvar
203 int gamecount = cvar("cl_matchcount");
204 localcmd(strcat("cl_matchcount ", itos(gamecount + 1), "\n"));
205 //cvar_set("cl_matchcount", itos(gamecount + 1));
206 }
207 else
208 localcmd("\ncl_hook_demoend\n");
209
210 calledhooks |= HOOK_END; // mark the hook as having fired
211 }
212
213 localcmd("\ncl_hook_shutdown\n");
214
215 localcmd("\n-button12\n");
216
218
221
223}
void deactivate_minigame()
void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger)
int ClientProgsDB
Definition main.qh:204
bool autocvar_cl_db_saveasdump
Definition main.qh:6
int calledhooks
Definition main.qh:164
entity players
Definition main.qh:57
string gametype_custom_name
Definition main.qh:44
int binddb
Definition main.qh:191
float chase_active_backup
Definition main.qh:154
const int HOOK_START
Definition main.qh:165
int tempdb
Definition main.qh:203
const int HOOK_END
Definition main.qh:166
entity teams
Definition main.qh:58
float camera_active
Definition main.qh:153
#define itos(i)
Definition int.qh:6
const int REPLICATEVARS_DESTROY
Definition replicate.qh:6
void WarpZone_Shutdown()
Definition client.qc:290
ERASEABLE void db_close(int db)
Definition map.qh:84
ERASEABLE void db_save(int db, string filename)
Definition map.qh:8
ERASEABLE void db_dump(int db, string filename)
Definition map.qh:69
float isdemo()
float cvar(string name)
const string cvar_defstring(string name)
void ReplicateVars(bool would_destroy)
Definition all.qh:895
int autocvar_chase_active
Definition view.qh:17
bool autocvar_r_drawviewmodel
Definition view.qh:97

References __init_dedicated_server_shutdown(), autocvar_chase_active, autocvar_cl_db_saveasdump, autocvar_developer, autocvar_r_drawviewmodel, autocvar_sessionid, autocvar_sv_db_saveasdump, Ban_SaveBans(), binddb, bot_endgame(), calledhooks, camera_active, chase_active_backup, cheatcount_total, CheatShutdown(), ClientProgsDB, cvar(), cvar_defstring(), cvar_set(), db_close(), db_dump(), db_save(), deactivate_minigame(), FOREACH_ENTITY_ORDERED, ftos(), game_stopped, gametype_custom_name, HOOK_END, HOOK_START, HUD_MinigameMenu_Close(), isdemo(), itos, loaded_gametype_custom_string, localcmd(), LOG_INFO, LOG_TRACE, m_hide(), MapInfo_Shutdown(), NULL, orig_slowmo, players, PlayerStats_GameReport(), ReplicateVars(), REPLICATEVARS_DESTROY, ServerProgsDB, strcat(), strfree, sv_termsofservice_url_escaped, teams, tempdb, TemporaryDB, TIMEOUT_ACTIVE, timeout_status, WarpZone_Shutdown(), WeaponStats_Shutdown(), and world_initialized.

Referenced by SV_Shutdown().

◆ Skeleton_SetBones()

void Skeleton_SetBones ( entity e)

Definition at line 1733 of file util.qc.

1734{
1735 // set skeleton_bones to the total number of bones on the model
1736 if(e.skeleton_bones_index == e.modelindex)
1737 return; // same model, nothing to update
1738
1739 float skelindex;
1740 skelindex = skel_create(e.modelindex);
1741 e.skeleton_bones = skel_get_numbones(skelindex);
1742 skel_delete(skelindex);
1743 e.skeleton_bones_index = e.modelindex;
1744}

References entity().

◆ solve_shotdirection()

vector solve_shotdirection ( vector myorg,
vector myvel,
vector eorg,
vector evel,
float spd,
float newton_style )

Definition at line 1133 of file util.qc.

1134{
1135 vector ret;
1136
1137 // make origin and speed relative
1138 eorg -= myorg;
1139 if(newton_style)
1140 evel -= myvel;
1141
1142 // now solve for ret, ret normalized:
1143 // eorg + t * evel == t * ret * spd
1144 // or, rather, solve for t:
1145 // |eorg + t * evel| == t * spd
1146 // eorg^2 + t^2 * evel^2 + 2 * t * (eorg * evel) == t^2 * spd^2
1147 // t^2 * (evel^2 - spd^2) + t * (2 * (eorg * evel)) + eorg^2 == 0
1148 vector solution = solve_quadratic(evel * evel - spd * spd, 2 * (eorg * evel), eorg * eorg);
1149 // p = 2 * (eorg * evel) / (evel * evel - spd * spd)
1150 // q = (eorg * eorg) / (evel * evel - spd * spd)
1151 if(!solution.z) // no real solution
1152 {
1153 // happens if D < 0
1154 // (eorg * evel)^2 < (evel^2 - spd^2) * eorg^2
1155 // (eorg * evel)^2 / eorg^2 < evel^2 - spd^2
1156 // spd^2 < ((evel^2 * eorg^2) - (eorg * evel)^2) / eorg^2
1157 // spd^2 < evel^2 * (1 - cos^2 angle(evel, eorg))
1158 // spd^2 < evel^2 * sin^2 angle(evel, eorg)
1159 // spd < |evel| * sin angle(evel, eorg)
1160 return '0 0 0';
1161 }
1162 else if(solution.x > 0)
1163 {
1164 // both solutions > 0: take the smaller one
1165 // happens if p < 0 and q > 0
1166 ret = normalize(eorg + solution.x * evel);
1167 }
1168 else if(solution.y > 0)
1169 {
1170 // one solution > 0: take the larger one
1171 // happens if q < 0 or q == 0 and p < 0
1172 ret = normalize(eorg + solution.y * evel);
1173 }
1174 else
1175 {
1176 // no solution > 0: reject
1177 // happens if p > 0 and q >= 0
1178 // 2 * (eorg * evel) / (evel * evel - spd * spd) > 0
1179 // (eorg * eorg) / (evel * evel - spd * spd) >= 0
1180 //
1181 // |evel| >= spd
1182 // eorg * evel > 0
1183 //
1184 // "Enemy is moving away from me at more than spd"
1185 return '0 0 0';
1186 }
1187
1188 // NOTE: we always got a solution if spd > |evel|
1189
1190 if(newton_style == 2)
1191 ret = normalize(ret * spd + myvel);
1192
1193 return ret;
1194}
vector normalize(vector v)

References normalize(), solve_quadratic(), and vector.

◆ STATIC_INIT()

STATIC_INIT ( g_saved_cvars )

Definition at line 34 of file util.qh.

34{ g_saved_cvars = IL_NEW(); }
#define IL_NEW()

References g_saved_cvars, and IL_NEW.

◆ strtolower()

◆ swapInPriorityList()

string swapInPriorityList ( string order,
float i,
float j )

Definition at line 655 of file util.qc.

656{
657 float n = tokenize_console(order);
658
659 if(i >= 0 && i < n && j >= 0 && j < n && i != j)
660 {
661 string s = "";
662 for(float w = 0; w < n; ++w)
663 {
664 if(w == i)
665 s = strcat(s, argv(j), " ");
666 else if(w == j)
667 s = strcat(s, argv(i), " ");
668 else
669 s = strcat(s, argv(w), " ");
670 }
671 return substring(s, 0, strlen(s) - 1);
672 }
673
674 return order;
675}

References argv(), strcat(), strlen, substring(), and tokenize_console.

Referenced by WeaponsList_MoveDown_Click(), WeaponsList_MoveUp_Click(), XonoticPlayList_mouseDrag(), and XonoticWeaponsList_mouseDrag().

◆ textLengthUpToLength()

float textLengthUpToLength ( string theText,
int maxLength,
textLengthUpToLength_lenFunction_t tw )

Definition at line 924 of file util.qc.

925{
926 // STOP.
927 // The following function is SLOW.
928 // For your safety and for the protection of those around you...
929 // DO NOT CALL THIS AT HOME.
930 // No really, don't.
931 if(w(theText) <= maxLength)
932 return strlen(theText); // yeah!
933
934 bool colors = (w("^7") == 0);
935
936 // binary search for right place to cut string
937 int len, left, right, middle;
938 left = 0;
939 right = len = strlen(theText);
940 int ofs = 0;
941 do
942 {
943 middle = floor((left + right) / 2);
944 if(colors)
945 {
946 vector res = checkColorCode(theText, len, middle, true);
947 ofs = (!res.x) ? 0 : res.x - res.y;
948 }
949
950 if(w(substring(theText, 0, middle + ofs)) <= maxLength)
951 left = middle + ofs;
952 else
953 right = middle;
954 }
955 while(left < right - 1);
956
957 return left;
958}
ERASEABLE vector checkColorCode(string theText, int text_len, int pos, bool check_at_the_end)
Definition string.qh:609

References checkColorCode(), floor(), strlen, substring(), and vector.

Referenced by getWrappedLineLen(), PlayerFrame(), and textShortenToLength().

◆ textLengthUpToWidth()

float textLengthUpToWidth ( string theText,
float maxWidth,
vector size,
textLengthUpToWidth_widthFunction_t tw )

Definition at line 888 of file util.qc.

889{
890 // STOP.
891 // The following function is SLOW.
892 // For your safety and for the protection of those around you...
893 // DO NOT CALL THIS AT HOME.
894 // No really, don't.
895 if(w(theText, theSize) <= maxWidth)
896 return strlen(theText); // yeah!
897
898 bool colors = (w("^7", theSize) == 0);
899
900 // binary search for right place to cut string
901 int len, left, right, middle;
902 left = 0;
903 right = len = strlen(theText);
904 int ofs = 0;
905 do
906 {
907 middle = floor((left + right) / 2);
908 if(colors)
909 {
910 vector res = checkColorCode(theText, len, middle, false);
911 ofs = (res.x) ? res.x - res.y : 0;
912 }
913
914 if(w(substring(theText, 0, middle + ofs), theSize) <= maxWidth)
915 left = middle + ofs;
916 else
917 right = middle;
918 }
919 while(left < right - 1);
920
921 return left;
922}

References checkColorCode(), floor(), strlen, substring(), and vector.

Referenced by draw_TextLengthUpToWidth(), getWrappedLine(), minigame_getWrappedLine(), and textShortenToWidth().

◆ textShortenToLength()

string textShortenToLength ( string theText,
int maxLength,
textLengthUpToLength_lenFunction_t tw )

◆ textShortenToWidth()

◆ trace_hits_box()

float trace_hits_box ( vector start,
vector end,
vector thmi,
vector thma )

Definition at line 2123 of file util.qc.

2124{
2125 end -= start;
2126 thmi -= start;
2127 thma -= start;
2128 // now it is a trace from 0 to end
2129
2132
2133 if (!trace_hits_box_1d(end.x, thmi.x, thma.x))
2134 return false;
2135 if (!trace_hits_box_1d(end.y, thmi.y, thma.y))
2136 return false;
2137 if (!trace_hits_box_1d(end.z, thmi.z, thma.z))
2138 return false;
2139
2140 return true;
2141}
float trace_hits_box_a1
Definition util.qc:2099
float trace_hits_box_a0
Definition util.qc:2099
float trace_hits_box_1d(float end, float thmi, float thma)
Definition util.qc:2101

References trace_hits_box_1d(), trace_hits_box_a0, trace_hits_box_a1, and vector.

Referenced by Headshot(), and tracebox_hits_box().

◆ trace_hits_box_1d()

float trace_hits_box_1d ( float end,
float thmi,
float thma )

Definition at line 2101 of file util.qc.

2102{
2103 if (end == 0)
2104 {
2105 // just check if x is in range
2106 if (0 < thmi)
2107 return false;
2108 if (0 > thma)
2109 return false;
2110 }
2111 else
2112 {
2113 // do the trace with respect to x
2114 // 0 -> end has to stay in thmi -> thma
2115 trace_hits_box_a0 = max(trace_hits_box_a0, min(thmi / end, thma / end));
2116 trace_hits_box_a1 = min(trace_hits_box_a1, max(thmi / end, thma / end));
2118 return false;
2119 }
2120 return true;
2121}
float min(float f,...)
float max(float f,...)

References max(), min(), trace_hits_box_a0, and trace_hits_box_a1.

Referenced by trace_hits_box().

◆ tracebox_hits_box()

float tracebox_hits_box ( vector start,
vector mi,
vector ma,
vector end,
vector thmi,
vector thma )

Definition at line 2143 of file util.qc.

2144{
2145 return trace_hits_box(start, end, thmi - ma, thma - mi);
2146}
float trace_hits_box(vector start, vector end, vector thmi, vector thma)
Definition util.qc:2123

References trace_hits_box(), and vector.

Referenced by tracebox_hits_trigger_hurt().

◆ tracebox_inverted()

float tracebox_inverted ( vector v1,
vector mi,
vector ma,
vector v2,
float nomonsters,
entity forent,
float stopatentity,
entity ignorestopatentity )

Definition at line 23 of file util.qc.

24{
25 vector pos, dir, t;
26 float nudge;
27 entity stopentity;
28
29 //nudge = 2 * cvar("collision_impactnudge"); // why not?
30 nudge = 0.5;
31
32 dir = normalize(v2 - v1);
33
34 pos = v1 + dir * nudge;
35
36 float c;
37 c = 0;
38
39 for (;;)
40 {
41 if(pos * dir >= v2 * dir)
42 {
43 // went too far
45 trace_endpos = v2;
46 return c;
47 }
48
49 tracebox(pos, mi, ma, v2, nomonsters, forent);
50 ++c;
51
52 if(c == 50)
53 {
54 LOG_TRACE("When tracing from ", vtos(v1), " to ", vtos(v2));
55 LOG_TRACE(" Nudging gets us nowhere at ", vtos(pos));
56 LOG_TRACE(" trace_endpos is ", vtos(trace_endpos));
57 LOG_TRACE(" trace distance is ", ftos(vlen(pos - trace_endpos)));
58 }
59
60 stopentity = trace_ent;
61
63 {
64 // we started inside solid.
65 // then trace from endpos to pos
66 t = trace_endpos;
67 tracebox(t, mi, ma, pos, nomonsters, forent);
68 ++c;
70 {
71 // t is still inside solid? bad
72 // force advance, then, and retry
73 pos = t + dir * nudge;
74
75 // but if we hit an entity, stop RIGHT before it
76 if(stopatentity && stopentity && stopentity != ignorestopatentity)
77 {
78 trace_ent = stopentity;
79 trace_endpos = t;
80 trace_fraction = ((trace_endpos - v1) * dir) / ((v2 - v1) * dir);
81 return c;
82 }
83 }
84 else
85 {
86 // we actually LEFT solid!
87 trace_fraction = ((trace_endpos - v1) * dir) / ((v2 - v1) * dir);
88 return c;
89 }
90 }
91 else
92 {
93 // pos is outside solid?!? but why?!? never mind, just return it.
94 trace_endpos = pos;
95 trace_fraction = ((trace_endpos - v1) * dir) / ((v2 - v1) * dir);
96 return c;
97 }
98 }
99}
entity trace_ent
int dir
Definition impulse.qc:89

References dir, entity(), ftos(), LOG_TRACE, normalize(), trace_endpos, trace_ent, trace_fraction, trace_startsolid, vector, vlen(), and vtos().

Referenced by traceline_inverted().

◆ traceline_inverted()

void traceline_inverted ( vector v1,
vector v2,
float nomonsters,
entity forent,
float stopatentity,
entity ignorestopatentity )

Definition at line 101 of file util.qc.

102{
103 tracebox_inverted(v1, '0 0 0', '0 0 0', v2, nomonsters, forent, stopatentity, ignorestopatentity);
104}
float tracebox_inverted(vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity)
Definition util.qc:23

References entity(), tracebox_inverted(), and vector.

Referenced by fireBullet_falloff().

◆ translate_key()

ERASEABLE string translate_key ( string key)

Definition at line 1512 of file util.qc.

1513{
1514 if (prvm_language == "en") return key;
1515
1516 if (substring(key, 0, 1) == "<")
1517 {
1518 if (key == "<KEY NOT FOUND>") return _("<KEY NOT FOUND>");
1519 if (key == "<UNKNOWN KEYNUM>") return _("<UNKNOWN KEYNUM>");
1520 }
1521
1522 switch(key)
1523 {
1524 case "TAB": return _("TAB");
1525 case "ENTER": return _("ENTER");
1526 case "ESCAPE": return _("ESCAPE");
1527 case "SPACE": return _("SPACE");
1528
1529 case "BACKSPACE": return _("BACKSPACE");
1530 case "UPARROW": return _("UPARROW");
1531 case "DOWNARROW": return _("DOWNARROW");
1532 case "LEFTARROW": return _("LEFTARROW");
1533 case "RIGHTARROW": return _("RIGHTARROW");
1534
1535 case "ALT": return _("ALT");
1536 case "CTRL": return _("CTRL");
1537 case "SHIFT": return _("SHIFT");
1538
1539 case "INS": return _("INS");
1540 case "DEL": return _("DEL");
1541 case "PGDN": return _("PGDN");
1542 case "PGUP": return _("PGUP");
1543 case "HOME": return _("HOME");
1544 case "END": return _("END");
1545
1546 case "PAUSE": return _("PAUSE");
1547
1548 case "NUMLOCK": return _("NUMLOCK");
1549 case "CAPSLOCK": return _("CAPSLOCK");
1550 case "SCROLLOCK": return _("SCROLLOCK");
1551
1552 case "SEMICOLON": return _("SEMICOLON");
1553 case "TILDE": return _("TILDE");
1554 case "BACKQUOTE": return _("BACKQUOTE");
1555 case "QUOTE": return _("QUOTE");
1556 case "APOSTROPHE": return _("APOSTROPHE");
1557 case "BACKSLASH": return _("BACKSLASH");
1558 }
1559
1560 if (substring(key, 0, 1) == "F")
1561 {
1562 string subkey = substring(key, 1, -1);
1563 if (IS_DIGIT(substring(key, 3, 1))) // check only first digit
1564 {
1565 return sprintf(_("F%d"), stof(subkey));
1566 }
1567 // continue in case there is another key name starting with F
1568 }
1569
1570 if (substring(key, 0, 3) == "KP_")
1571 {
1572 string subkey = substring(key, 3, -1);
1573 if (IS_DIGIT(substring(key, 3, 1))) // check only first digit
1574 {
1575 return sprintf(_("KP_%d"), stof(subkey));
1576 }
1577
1578 switch(subkey)
1579 {
1580 case "INS": return sprintf(_("KP_%s"), _("INS"));
1581 case "END": return sprintf(_("KP_%s"), _("END"));
1582 case "DOWNARROW": return sprintf(_("KP_%s"), _("DOWNARROW"));
1583 case "PGDN": return sprintf(_("KP_%s"), _("PGDN"));
1584 case "LEFTARROW": return sprintf(_("KP_%s"), _("LEFTARROW"));
1585 case "RIGHTARROW": return sprintf(_("KP_%s"), _("RIGHTARROW"));
1586 case "HOME": return sprintf(_("KP_%s"), _("HOME"));
1587 case "UPARROW": return sprintf(_("KP_%s"), _("UPARROW"));
1588 case "PGUP": return sprintf(_("KP_%s"), _("PGUP"));
1589 case "PERIOD": return sprintf(_("KP_%s"), _("PERIOD"));
1590 case "DEL": return sprintf(_("KP_%s"), _("DEL"));
1591 case "DIVIDE": return sprintf(_("KP_%s"), _("DIVIDE"));
1592 case "SLASH": return sprintf(_("KP_%s"), _("SLASH"));
1593 case "MULTIPLY": return sprintf(_("KP_%s"), _("MULTIPLY"));
1594 case "MINUS": return sprintf(_("KP_%s"), _("MINUS"));
1595 case "PLUS": return sprintf(_("KP_%s"), _("PLUS"));
1596 case "ENTER": return sprintf(_("KP_%s"), _("ENTER"));
1597 case "EQUALS": return sprintf(_("KP_%s"), _("EQUALS"));
1598 default: return key;
1599 }
1600 }
1601
1602 if (key == "PRINTSCREEN") return _("PRINTSCREEN");
1603
1604 if (substring(key, 0, 5) == "MOUSE")
1605 return sprintf(_("MOUSE%d"), stof(substring(key, 5, -1)));
1606
1607 if (key == "MWHEELUP") return _("MWHEELUP");
1608 if (key == "MWHEELDOWN") return _("MWHEELDOWN");
1609
1610 if (substring(key, 0,3) == "JOY")
1611 return sprintf(_("JOY%d"), stof(substring(key, 3, -1)));
1612
1613 if (substring(key, 0,3) == "AUX")
1614 return sprintf(_("AUX%d"), stof(substring(key, 3, -1)));
1615
1616 if (substring(key, 0, 4) == "X360_")
1617 {
1618 string subkey = substring(key, 4, -1);
1619 switch(subkey)
1620 {
1621 case "DPAD_UP": return sprintf(_("X360_%s"), _("DPAD_UP"));
1622 case "DPAD_DOWN": return sprintf(_("X360_%s"), _("DPAD_DOWN"));
1623 case "DPAD_LEFT": return sprintf(_("X360_%s"), _("DPAD_LEFT"));
1624 case "DPAD_RIGHT": return sprintf(_("X360_%s"), _("DPAD_RIGHT"));
1625 case "START": return sprintf(_("X360_%s"), _("START"));
1626 case "BACK": return sprintf(_("X360_%s"), _("BACK"));
1627 case "LEFT_THUMB": return sprintf(_("X360_%s"), _("LEFT_THUMB"));
1628 case "RIGHT_THUMB": return sprintf(_("X360_%s"), _("RIGHT_THUMB"));
1629 case "LEFT_SHOULDER": return sprintf(_("X360_%s"), _("LEFT_SHOULDER"));
1630 case "RIGHT_SHOULDER": return sprintf(_("X360_%s"), _("RIGHT_SHOULDER"));
1631 case "LEFT_TRIGGER": return sprintf(_("X360_%s"), _("LEFT_TRIGGER"));
1632 case "RIGHT_TRIGGER": return sprintf(_("X360_%s"), _("RIGHT_TRIGGER"));
1633 case "LEFT_THUMB_UP": return sprintf(_("X360_%s"), _("LEFT_THUMB_UP"));
1634 case "LEFT_THUMB_DOWN": return sprintf(_("X360_%s"), _("LEFT_THUMB_DOWN"));
1635 case "LEFT_THUMB_LEFT": return sprintf(_("X360_%s"), _("LEFT_THUMB_LEFT"));
1636 case "LEFT_THUMB_RIGHT": return sprintf(_("X360_%s"), _("LEFT_THUMB_RIGHT"));
1637 case "RIGHT_THUMB_UP": return sprintf(_("X360_%s"), _("RIGHT_THUMB_UP"));
1638 case "RIGHT_THUMB_DOWN": return sprintf(_("X360_%s"), _("RIGHT_THUMB_DOWN"));
1639 case "RIGHT_THUMB_LEFT": return sprintf(_("X360_%s"), _("RIGHT_THUMB_LEFT"));
1640 case "RIGHT_THUMB_RIGHT": return sprintf(_("X360_%s"), _("RIGHT_THUMB_RIGHT"));
1641 default: return key;
1642 }
1643 }
1644
1645 if (substring(key, 0, 4) == "JOY_")
1646 {
1647 string subkey = substring(key, 4, -1);
1648 switch(subkey)
1649 {
1650 case "UP": return sprintf(_("JOY_%s"), _("UP"));
1651 case "DOWN": return sprintf(_("JOY_%s"), _("DOWN"));
1652 case "LEFT": return sprintf(_("JOY_%s"), _("LEFT"));
1653 case "RIGHT": return sprintf(_("JOY_%s"), _("RIGHT"));
1654 default: return key;
1655 }
1656 }
1657
1658 if (substring(key, 0, 8) == "MIDINOTE")
1659 return sprintf(_("MIDINOTE%d"), stof(substring(key, 8, -1)));
1660
1661 return key;
1662}
string prvm_language
Definition i18n.qh:8

References IS_DIGIT, prvm_language, stof(), and substring().

Referenced by _getcommandkey(), KeyBinds_BuildList(), Scoreboard_Draw(), W_Guide_Keybinds(), and XonoticKeyBinder_drawListBoxItem().

◆ UnsetMovetypeFollow()

void UnsetMovetypeFollow ( entity ent)

Definition at line 2053 of file util.qc.

2054{
2057 ent.aiment_classname = string_null;
2058 // FIXME: engine bug?
2059 // resetting aiment the engine will set orb's origin close to world's origin
2060 //ent.aiment = NULL;
2061}
const int MOVETYPE_FLY
Definition movetypes.qh:134
#define PROJECTILE_MAKETRIGGER(e)
Definition common.qh:34

References entity(), MOVETYPE_FLY, PROJECTILE_MAKETRIGGER, set_movetype(), and string_null.

Referenced by W_MineLayer_Think().

◆ wordwrap()

string wordwrap ( string s,
float l )

Definition at line 170 of file util.qc.

171{
172 string r;
173 wordwrap_buffer = "";
175 r = wordwrap_buffer;
176 wordwrap_buffer = "";
177 return r;
178}
void wordwrap_cb(string s, float l, void(string) callback)
Definition util.qc:327
void wordwrap_buffer_put(string s)
Definition util.qc:165
string wordwrap_buffer
Definition util.qc:163

References wordwrap_buffer, wordwrap_buffer_put(), and wordwrap_cb().

◆ wordwrap_cb()

void wordwrap_cb ( string s,
float l,
void(string) callback )

Definition at line 327 of file util.qc.

328{
329 string c;
330 float lleft, i, j, wlen;
331
332 s = strzone(s);
333 lleft = l;
334 int len = strlen(s);
335 for (i = 0; i < len; ++i)
336 {
337 if (substring(s, i, 2) == "\\n")
338 {
339 callback("\n");
340 lleft = l;
341 ++i;
342 }
343 else if (substring(s, i, 1) == "\n")
344 {
345 callback("\n");
346 lleft = l;
347 }
348 else if (substring(s, i, 1) == " ")
349 {
350 if (lleft > 0)
351 {
352 callback(" ");
353 --lleft;
354 }
355 }
356 else
357 {
358 for (j = i+1; j < len; ++j)
359 // ^^ this skips over the first character of a word, which
360 // is ALWAYS part of the word
361 // this is safe since if i+1 == strlen(s), i will become
362 // strlen(s)-1 at the end of this block and the function
363 // will terminate. A space can't be the first character we
364 // read here, and neither can a \n be the start, since these
365 // two cases have been handled above.
366 {
367 c = substring(s, j, 1);
368 if (c == " ")
369 break;
370 if (c == "\\")
371 break;
372 if (c == "\n")
373 break;
374 // we need to keep this tempstring alive even if substring is
375 // called repeatedly, so call strcat even though we're not
376 // doing anything
377 callback("");
378 }
379 wlen = j - i;
380 if (lleft < wlen)
381 {
382 callback("\n");
383 lleft = l;
384 }
385 callback(substring(s, i, wlen));
386 lleft -= wlen;
387 i = j - 1;
388 }
389 }
390 strunzone(s);
391}

References strlen, strunzone(), strzone(), and substring().

Referenced by wordwrap(), and wordwrap_sprint().

◆ wordwrap_sprint()

void wordwrap_sprint ( entity to,
string s,
float l )

Definition at line 192 of file util.qc.

193{
194 wordwrap_buffer = "";
198 if(wordwrap_buffer != "")
199 sprint(to, strcat(wordwrap_buffer, "\n"));
200 wordwrap_buffer = "";
201 return;
202}
void wordwrap_buffer_sprint(string s)
Definition util.qc:182
entity _wordwrap_buffer_sprint_ent
Definition util.qc:181
void sprint(float clientnum, string text,...)

References _wordwrap_buffer_sprint_ent, entity(), NULL, sprint(), strcat(), wordwrap_buffer, wordwrap_buffer_sprint(), and wordwrap_cb().

Referenced by CommonCommand_info(), and VoteCommand_macro_help().

◆ write_String_To_File()

void write_String_To_File ( int fh,
string str,
bool alsoprint )

Definition at line 1375 of file util.qc.

1376{
1377 fputs(fh, str);
1378 if (alsoprint) LOG_HELP(str);
1379}
#define LOG_HELP(...)
Definition log.qh:85

References fputs(), and LOG_HELP.

◆ xdecode()

float xdecode ( string s)

Definition at line 1682 of file util.qc.

1683{
1684 float a, b, c, d;
1685 if(substring(s, 0, 1) != "^")
1686 return -1;
1687 if(strlen(s) < 5)
1688 return -1;
1689 a = strstrofs(XENCODE_2, substring(s, 1, 1), 0);
1690 b = strstrofs(XENCODE_22, substring(s, 2, 1), 0);
1691 c = strstrofs(XENCODE_22, substring(s, 3, 1), 0);
1692 d = strstrofs(XENCODE_22, substring(s, 4, 1), 0);
1693 if(a < 0 || b < 0 || c < 0 || d < 0)
1694 return -1;
1695 return ((a * 22 + b) * 22 + c) * 22 + d;
1696}
const string XENCODE_22
Definition util.qc:1666
const string XENCODE_2
Definition util.qc:1665

References strlen, strstrofs, substring(), XENCODE_2, and XENCODE_22.

◆ xencode()

string xencode ( float f)

Variable Documentation

◆ autocvar_cl_gentle

bool autocvar_cl_gentle

Definition at line 236 of file util.qh.

Referenced by DamageEffect(), HUD_Damage(), and NET_HANDLE().

◆ autocvar_cl_gentle_messages

int autocvar_cl_gentle_messages

Definition at line 237 of file util.qh.

◆ CNT_GAMESTART

const int CNT_GAMESTART = 2

Definition at line 252 of file util.qh.

Referenced by Announcer_Countdown(), and Announcer_PickNumber().

◆ CNT_KILL

const int CNT_KILL = 4

Definition at line 254 of file util.qh.

Referenced by Announcer_PickNumber(), and KillIndicator_Think().

◆ CNT_NORMAL

const int CNT_NORMAL = 1

Definition at line 251 of file util.qh.

Referenced by Announcer_PickNumber(), and instagib_countdown().

◆ CNT_RESPAWN

const int CNT_RESPAWN = 5

Definition at line 255 of file util.qh.

Referenced by Announcer_PickNumber(), and ShowRespawnCountdown().

◆ CNT_ROUNDSTART

const int CNT_ROUNDSTART = 6

Definition at line 256 of file util.qh.

Referenced by Announcer_Countdown(), and Announcer_PickNumber().

◆ config_queue

◆ g_saved_cvars

IntrusiveList g_saved_cvars

Definition at line 33 of file util.qh.

Referenced by cvar_settemp(), and STATIC_INIT().

◆ get_model_parameters_age

float get_model_parameters_age

Definition at line 183 of file util.qh.

Referenced by get_model_parameters(), and XonoticPlayerModelSelector_loadModels().

◆ get_model_parameters_bone_aim

string get_model_parameters_bone_aim[MAX_AIM_BONES]

Definition at line 189 of file util.qh.

Referenced by get_model_parameters(), and skeleton_loadinfo().

◆ get_model_parameters_bone_aimweight

float get_model_parameters_bone_aimweight[MAX_AIM_BONES]

Definition at line 190 of file util.qh.

Referenced by get_model_parameters(), and skeleton_loadinfo().

◆ get_model_parameters_bone_upperbody

string get_model_parameters_bone_upperbody

Definition at line 186 of file util.qh.

Referenced by get_model_parameters(), and skeleton_loadinfo().

◆ get_model_parameters_bone_weapon

string get_model_parameters_bone_weapon

Definition at line 187 of file util.qh.

Referenced by get_model_parameters(), and skeleton_loadinfo().

◆ get_model_parameters_desc

string get_model_parameters_desc

Definition at line 192 of file util.qh.

Referenced by get_model_parameters(), and XonoticPlayerModelSelector_loadModels().

◆ get_model_parameters_description

string get_model_parameters_description

Definition at line 185 of file util.qh.

Referenced by get_model_parameters(), and XonoticPlayerModelSelector_loadModels().

◆ get_model_parameters_fixbone

float get_model_parameters_fixbone

Definition at line 191 of file util.qh.

Referenced by get_model_parameters(), and skeleton_loadinfo().

◆ get_model_parameters_hidden

bool get_model_parameters_hidden

Definition at line 184 of file util.qh.

Referenced by get_model_parameters(), and XonoticPlayerModelSelector_loadModels().

◆ get_model_parameters_modelname

string get_model_parameters_modelname

Definition at line 177 of file util.qh.

Referenced by get_model_parameters(), and XonoticPlayerModelSelector_loadModels().

◆ get_model_parameters_modelskin

float get_model_parameters_modelskin

Definition at line 178 of file util.qh.

Referenced by get_model_parameters(), and XonoticPlayerModelSelector_loadModels().

◆ get_model_parameters_name

string get_model_parameters_name

Definition at line 179 of file util.qh.

Referenced by get_model_parameters(), and XonoticPlayerModelSelector_loadModels().

◆ get_model_parameters_sex

string get_model_parameters_sex

Definition at line 181 of file util.qh.

Referenced by get_model_parameters(), and XonoticPlayerModelSelector_loadModels().

◆ get_model_parameters_species

float get_model_parameters_species

Definition at line 180 of file util.qh.

Referenced by get_model_parameters(), and player_getspecies().

◆ get_model_parameters_weight

float get_model_parameters_weight

Definition at line 182 of file util.qh.

Referenced by get_model_parameters(), and XonoticPlayerModelSelector_loadModels().

◆ getWrappedLine_remaining

◆ ladder_reply

string ladder_reply

Definition at line 161 of file util.qh.

Referenced by CommonCommand_ladder(), and spawnfunc().

◆ lsmaps_reply

string lsmaps_reply

Definition at line 161 of file util.qh.

Referenced by CommonCommand_lsmaps(), GameTypeVote_SetGametype(), and spawnfunc().

◆ maplist_reply

string maplist_reply

Definition at line 161 of file util.qh.

Referenced by CommonCommand_printmaplist(), and spawnfunc().

◆ MAX_AIM_BONES

const int MAX_AIM_BONES = 4

Definition at line 188 of file util.qh.

Referenced by classfield(), get_model_parameters(), skeleton_from_frames(), and skeleton_loadinfo().

◆ MAX_CONFIG_SETTINGS

const int MAX_CONFIG_SETTINGS = 70

Definition at line 26 of file util.qh.

Referenced by Dump_Turret_Settings(), Dump_Weapon_Settings(), T_Config_Queue(), and W_Config_Queue().

◆ message

string message

Definition at line 31 of file util.qh.

◆ mi_max

vector mi_max

◆ mi_min

vector mi_min

◆ mi_picmax

vector mi_picmax

◆ mi_picmin

vector mi_picmin

◆ mi_pictexcoord0

vector mi_pictexcoord0

Definition at line 133 of file util.qh.

Referenced by draw_teamradar_background(), and get_mi_min_max_texcoords().

◆ mi_pictexcoord1

vector mi_pictexcoord1

Definition at line 134 of file util.qh.

Referenced by draw_teamradar_background(), and get_mi_min_max_texcoords().

◆ mi_pictexcoord2

vector mi_pictexcoord2

Definition at line 135 of file util.qh.

Referenced by draw_teamradar_background(), and get_mi_min_max_texcoords().

◆ mi_pictexcoord3

vector mi_pictexcoord3

Definition at line 136 of file util.qh.

Referenced by draw_teamradar_background(), and get_mi_min_max_texcoords().

◆ mi_shortname

◆ monsterlist_reply

string monsterlist_reply

Definition at line 161 of file util.qh.

Referenced by CommonCommand_editmob(), and spawnfunc().

◆ netname

string netname

Definition at line 30 of file util.qh.

◆ rankings_reply

string rankings_reply

Definition at line 161 of file util.qh.

Referenced by CommonCommand_rankings(), race_deleteTime(), race_setTime(), and spawnfunc().

◆ records_reply

string records_reply[10]

Definition at line 162 of file util.qh.

Referenced by CommonCommand_records(), and spawnfunc().

◆ skeleton_bones

float skeleton_bones

Definition at line 213 of file util.qh.

◆ TIME_DECIMALS

const int TIME_DECIMALS = 2

Definition at line 94 of file util.qh.

Referenced by HUD_Score(), and MakeRaceString().

◆ TIME_FACTOR

const float TIME_FACTOR = 100

Definition at line 95 of file util.qh.

◆ XENCODE_LEN

const float XENCODE_LEN = 5

Definition at line 201 of file util.qh.

◆ XENCODE_MAX

const float XENCODE_MAX = 21295

Definition at line 200 of file util.qh.