Xonotic
util.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void CheckSendCvars (entity me, string cvarnamestring)
 
void clearTooltip (entity e)
 
void dialog_hudpanel_main_checkbox (entity me, string panelname)
 
void dialog_hudpanel_main_settings (entity me, string panelname)
 
void forAllDescendants (entity root, void(entity, entity) funcPre, void(entity, entity) funcPost, entity pass)
 
int GameType_GetCount ()
 
string GameType_GetIcon (int cnt)
 
entity GameType_GetID (int cnt)
 
string GameType_GetName (int cnt)
 
int GameType_GetTotalCount ()
 
string getCvarsMulti (entity me)
 
float getFadedAlpha (float currentAlpha, float startAlpha, float targetAlpha)
 
float GL_CheckExtension (string ext)
 
float GL_Have_TextureCompression ()
 
void loadAllCvars (entity root)
 
void makeCallback (entity me, entity cbent, void(entity, entity) cbfunc)
 
void makeMulti (entity me, string otherCvars)
 
string resolvemod (string m)
 
void saveAllCvars (entity root)
 
void setDependent (entity e, string theCvarName, float theCvarMin, float theCvarMax)
 
void setDependentAND (entity e, string theCvarName, float theCvarMin, float theCvarMax, string theCvar2Name, float theCvar2Min, float theCvar2Max)
 
void setDependentAND3 (entity e, string theCvarName, float theCvarMin, float theCvarMax, string theCvar2Name, float theCvar2Min, float theCvar2Max, string theCvar3Name, float theCvar3Min, float theCvar3Max)
 
void setDependentOR (entity e, string theCvarName, float theCvarMin, float theCvarMax, string theCvar2Name, float theCvar2Min, float theCvar2Max)
 
void setDependentStringNotEqual (entity e, string theCvarName, string theCvarValue)
 
void setDependentWeird (entity e, float(entity) func)
 
void setZonedTooltip (entity e, string theTooltip, string theCvar)
 
float updateCompression ()
 
void UpdateNotification_URI_Get_Callback (float id, float status, string data)
 

Variables

string _Nex_ExtResponseSystem_BannedServers
 
float _Nex_ExtResponseSystem_BannedServersNeedsRefresh
 
float _Nex_ExtResponseSystem_NewToS
 
string _Nex_ExtResponseSystem_PromotedServers
 
float _Nex_ExtResponseSystem_PromotedServersNeedsRefresh
 
string _Nex_ExtResponseSystem_RecommendedServers
 
float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh
 

Function Documentation

◆ CheckSendCvars()

void CheckSendCvars ( entity  me,
string  cvarnamestring 
)

Definition at line 841 of file util.qc.

References cmd(), cvar_string(), GAME_CONNECTED, GAME_ISSERVER, gamestatus, and LOG_INFOF.

Referenced by saveCvarsMulti(), XonoticCheckBox_saveCvars(), XonoticCheckBoxString_saveCvars(), XonoticInputBox_saveCvars(), XonoticSlider_saveCvars(), and XonoticTextSlider_saveCvars().

842 {
843  if(me.sendCvars)
844  {
846  {
847  LOG_INFOF("Sending cvar: %s -> %s", cvarnamestring, cvar_string(cvarnamestring));
848  cmd(sprintf("\nsendcvar %s\n", cvarnamestring));
849  }
850  }
851 }
#define LOG_INFOF(...)
Definition: log.qh:71
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearTooltip()

void clearTooltip ( entity  e)

Definition at line 277 of file util.qc.

References setZonedTooltip(), and string_null.

Referenced by XonoticGametypeList_focusedItemChangeNotify(), XonoticRegisteredSettingsList_getTooltip_cb(), XonoticServerList_focusedItemChangeNotify(), and XonoticServerList_mouseMove().

278 {
280 }
string string_null
Definition: nil.qh:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialog_hudpanel_main_checkbox()

void dialog_hudpanel_main_checkbox ( entity  me,
string  panelname 
)

Definition at line 764 of file util.qc.

References entity(), makeXonoticCheckBox(), strcat(), and strzone().

Referenced by XonoticHUDAmmoDialog_fill(), XonoticHUDCenterprintDialog_fill(), XonoticHUDChatDialog_fill(), XonoticHUDEngineInfoDialog_fill(), XonoticHUDHealthArmorDialog_fill(), XonoticHUDInfoMessagesDialog_fill(), XonoticHUDModIconsDialog_fill(), XonoticHUDNotificationDialog_fill(), XonoticHUDPowerupsDialog_fill(), XonoticHUDRaceTimerDialog_fill(), XonoticHUDScoreDialog_fill(), XonoticHUDTimerDialog_fill(), XonoticHUDVoteDialog_fill(), and XonoticHUDWeaponsDialog_fill().

765 {
766  entity e;
767 
768  me.TR(me);
769  me.TDempty(me, 1.5);
770  me.TD(me, 1, 2.5, e = makeXonoticCheckBox(0, strzone(strcat("hud_panel_", panelname)), _("Enable")));
771 }
entity() spawn
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialog_hudpanel_main_settings()

void dialog_hudpanel_main_settings ( entity  me,
string  panelname 
)

Definition at line 773 of file util.qc.

References entity(), and makeXonoticTextLabel().

Referenced by XonoticHUDAmmoDialog_fill(), XonoticHUDCenterprintDialog_fill(), XonoticHUDChatDialog_fill(), XonoticHUDEngineInfoDialog_fill(), XonoticHUDHealthArmorDialog_fill(), XonoticHUDInfoMessagesDialog_fill(), XonoticHUDModIconsDialog_fill(), XonoticHUDNotificationDialog_fill(), XonoticHUDPowerupsDialog_fill(), XonoticHUDQuickMenuDialog_fill(), XonoticHUDRaceTimerDialog_fill(), XonoticHUDScoreDialog_fill(), XonoticHUDTimerDialog_fill(), XonoticHUDVoteDialog_fill(), and XonoticHUDWeaponsDialog_fill().

774 {
775  float i;
776  entity e;
777 
778  me.gotoRC(me, me.currentRow + 1.5, 0);
779  me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Background:")));
780  me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg"))));
781  e.addValue(e, _("Default"), "");
782  e.addValue(e, _("Disable"), "0");
783  e.addValue(e, strzone(strcat("border_", panelname)), strzone(strcat("border_", panelname)));
784  e.configureXonoticTextSliderValues(e);
785  me.TR(me);
786  me.TDempty(me, 0.2);
787  me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Color:")));
788  me.TD(me, 2, 2.6, e = makeXonoticColorpickerString(strzone(strcat("hud_panel_", panelname, "_bg_color")), "hud_panel_bg_color"));
789  setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_bg_color")), "");
790  me.TR(me);
791  me.TDempty(me, 0.2);
792  me.TD(me, 1, 1.0, e = makeXonoticCheckBoxString("", "1 1 1", strzone(strcat("hud_panel_", panelname, "_bg_color")), _("Use default")));
793  me.TR(me);
794  me.TDempty(me, 0.2);
795  me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Border size:")));
796  me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_border"))));
797  e.addValue(e, _("Default"), "");
798  e.addValue(e, _("Disable"), "0");
799  for(i = 1; i <= 10; ++i)
800  e.addValue(e, strzone(ftos_decimals(i * 2, 0)), strzone(ftos(i * 2)));
801  e.configureXonoticTextSliderValues(e);
802  me.TR(me);
803  me.TDempty(me, 0.2);
804  me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:")));
805  me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_alpha"))));
806  e.addValue(e, _("Default"), "");
807  for(i = 1; i <= 10; ++i)
808  e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
809  e.configureXonoticTextSliderValues(e);
810  me.TR(me);
811  me.TDempty(me, 0.2);
812  me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Team Color:")));
813  me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_color_team"))));
814  e.addValue(e, _("Default"), "");
815  e.addValue(e, _("Disable"), "0");
816  for(i = 1; i <= 10; ++i)
817  e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
818  e.configureXonoticTextSliderValues(e);
819  me.TR(me);
820  me.TDempty(me, 0.4);
821  me.TD(me, 1, 3.6, e = makeXonoticCheckBox(0, "hud_configure_teamcolorforced", _("Test team color in configure mode")));
822  me.TR(me);
823  me.TDempty(me, 0.2);
824  me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Padding:")));
825  me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_padding"))));
826  e.addValue(e, _("Default"), "");
827  for(i = 0; i <= 10; ++i)
828  e.addValue(e, strzone(ftos_decimals(i - 5, 0)), strzone(ftos(i - 5)));
829  e.configureXonoticTextSliderValues(e);
830 }
ERASEABLE string ftos_decimals(float number, int decimals)
converts a number to a string with the indicated number of decimals
Definition: string.qh:450
entity() spawn
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ forAllDescendants()

void forAllDescendants ( entity  root,
void(entity, entity funcPre,
void(entity, entity funcPost,
entity  pass 
)

Definition at line 24 of file util.qc.

References depthfirst(), firstChild, nextSibling, and parent.

Referenced by loadAllCvars(), and saveAllCvars().

25 {
26  depthfirst(root, parent, firstChild, nextSibling, funcPre, funcPost, pass);
27 }
void depthfirst(entity start,.entity up,.entity downleft,.entity right, void(entity, entity) funcPre, void(entity, entity) funcPost, entity pass)
Definition: util.qc:281
#define pass(name, colormin, colormax)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GameType_GetCount()

int GameType_GetCount ( )

Definition at line 716 of file util.qc.

References cvar(), GAMETYPES, and HIDDEN_GAMETYPES.

Referenced by XonoticGametypeList_configureXonoticGametypeList(), XonoticGametypeList_draw(), and XonoticGametypeList_loadCvars().

717 {
718  int i = 0;
719  int dev = cvar("developer");
720  #define GAMETYPE(id) ++i;
721  GAMETYPES
722  #undef GAMETYPE
723  #define GAMETYPE(it) { if (dev > 0) ++i; }
725  #undef GAMETYPE
726  return i;
727 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GameType_GetIcon()

string GameType_GetIcon ( int  cnt)

Definition at line 745 of file util.qc.

References entity(), GameType_GetID(), makeXonoticCheckBox(), makeXonoticCheckBoxString(), makeXonoticColorpickerString(), makeXonoticTextLabel(), makeXonoticTextSlider(), MapInfo_Type_ToString(), and strcat().

Referenced by XonoticGametypeList_configureXonoticGametypeList(), and XonoticGametypeList_drawListBoxItem().

746 {
748  return i ? strcat("gametype_", MapInfo_Type_ToString(i)) : "";
749 }
string MapInfo_Type_ToString(Gametype t)
Definition: mapinfo.qc:616
float cnt
Definition: powerups.qc:24
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GameType_GetID()

entity GameType_GetID ( int  cnt)

Definition at line 706 of file util.qc.

References GAMETYPES, HIDDEN_GAMETYPES, and NULL.

Referenced by GameType_GetIcon(), GameType_GetName(), XonoticGametypeList_drawListBoxItem(), XonoticGametypeList_focusedItemChangeNotify(), XonoticGametypeList_loadCvars(), XonoticGametypeList_saveCvars(), and XonoticMapInfoDialog_loadMapInfo().

707 {
708  int i = 0;
709  #define GAMETYPE(it) { if (i++ == cnt) return it; }
710  GAMETYPES
712  #undef GAMETYPE
713  return NULL;
714 }
#define NULL
Definition: post.qh:17
+ Here is the caller graph for this function:

◆ GameType_GetName()

string GameType_GetName ( int  cnt)

Definition at line 739 of file util.qc.

References GameType_GetID(), and MapInfo_Type_ToText().

Referenced by XonoticGametypeList_drawListBoxItem().

740 {
742  return i ? MapInfo_Type_ToText(i) : "";
743 }
string MapInfo_Type_ToText(Gametype t)
Definition: mapinfo.qc:621
float cnt
Definition: powerups.qc:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GameType_GetTotalCount()

int GameType_GetTotalCount ( )

Definition at line 729 of file util.qc.

References GAMETYPES, and HIDDEN_GAMETYPES.

Referenced by XonoticGametypeList_configureXonoticGametypeList(), and XonoticMapInfoDialog_loadMapInfo().

730 {
731  int i = 0;
732  #define GAMETYPE(id) ++i;
733  GAMETYPES
735  #undef GAMETYPE
736  return i;
737 }
+ Here is the caller graph for this function:

◆ getCvarsMulti()

string getCvarsMulti ( entity  me)

Definition at line 58 of file util.qc.

References string_null.

Referenced by gettooltip().

59 {
60  if (me.controlledCvars_Multi)
61  return me.controlledCvars_Multi;
62  return string_null;
63 }
string string_null
Definition: nil.qh:9
+ Here is the caller graph for this function:

◆ getFadedAlpha()

float getFadedAlpha ( float  currentAlpha,
float  startAlpha,
float  targetAlpha 
)

Definition at line 832 of file util.qc.

References frametime, max(), and min().

Referenced by XonoticCampaignList_drawListBoxItem(), XonoticCvarList_drawListBoxItem(), XonoticDemoList_drawListBoxItem(), XonoticGametypeList_drawListBoxItem(), XonoticHUDSkinList_drawListBoxItem(), XonoticKeyBinder_drawListBoxItem(), XonoticLanguageList_drawListBoxItem(), XonoticMapList_drawListBoxItem(), XonoticPicker_draw(), XonoticPlayList_drawListBoxItem(), XonoticRegisteredSettingsList_getTooltip_cb(), XonoticScreenshotList_drawListBoxItem(), XonoticServerList_drawListBoxItem(), XonoticSkinList_drawListBoxItem(), XonoticSoundList_drawListBoxItem(), XonoticStatsList_drawListBoxItem(), and XonoticWeaponsList_drawListBoxItem().

833 {
834  if(startAlpha < targetAlpha)
835  currentAlpha = min(currentAlpha + frametime * 0.5, targetAlpha);
836  else
837  currentAlpha = max(currentAlpha - frametime * 0.5, targetAlpha);
838  return currentAlpha;
839 }
float frametime
Definition: csprogsdefs.qc:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GL_CheckExtension()

float GL_CheckExtension ( string  ext)

Definition at line 13 of file util.qc.

References cvar_string(), and strhasword.

Referenced by GL_Have_TextureCompression().

14 {
15  return strhasword(cvar_string("gl_info_extensions"), ext);
16 }
#define strhasword(s, w)
Definition: string.qh:352
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GL_Have_TextureCompression()

float GL_Have_TextureCompression ( )

Definition at line 18 of file util.qc.

References GL_CheckExtension().

Referenced by updateCompression().

19 {
20  return GL_CheckExtension("GL_EXT_texture_compression_s3tc");
21 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadAllCvars()

void loadAllCvars ( entity  root)

Definition at line 51 of file util.qc.

References forAllDescendants(), loadCvarsOf(), NULL, and SUB_Null_ee().

Referenced by m_sync(), XonoticCvarsDialog_showNotify(), XonoticDamageTextSettings::XonoticDamageTextSettings ::showNotify(), XonoticGameCrosshairSettingsTab_showNotify(), XonoticGameHUDSettingsTab_showNotify(), XonoticGameMessageSettingsTab_showNotify(), XonoticGameModelSettingsTab_showNotify(), XonoticGameViewSettingsTab_showNotify(), XonoticGameWeaponsSettingsTab_showNotify(), XonoticMutatorsDialog_showNotify(), XonoticRootDialog_showNotify(), and XonoticTab_showNotify().

52 {
54 }
#define NULL
Definition: post.qh:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeCallback()

void makeCallback ( entity  me,
entity  cbent,
void(entity, entity cbfunc 
)

Definition at line 105 of file util.qc.

References entity(), and saveCvarsCallback().

106 {
107  e.saveCvars_Callback = e.saveCvars;
108  e.saveCvars = saveCvarsCallback;
109  e.saveCvars_Callback_ent = cbent;
110  e.saveCvars_Callback_func = cbfunc;
111 }
+ Here is the call graph for this function:

◆ makeMulti()

void makeMulti ( entity  me,
string  otherCvars 
)

Definition at line 90 of file util.qc.

References entity(), and saveCvarsMulti().

91 {
92  e.controlledCvars_Multi = otherCvars;
93  e.saveCvars_Multi = e.saveCvars;
94  e.saveCvars = saveCvarsMulti;
95 }
+ Here is the call graph for this function:

◆ resolvemod()

string resolvemod ( string  m)

Definition at line 620 of file util.qc.

References getcurrentmod().

Referenced by XonoticServerList_refreshServerList().

621 {
622  if(m == "=")
623  return getcurrentmod();
624  else
625  return m;
626 }
string getcurrentmod()
Definition: util.qc:1191
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAllCvars()

void saveAllCvars ( entity  root)

Definition at line 47 of file util.qc.

References forAllDescendants(), NULL, saveCvarsOf(), and SUB_Null_ee().

48 {
50 }
#define NULL
Definition: post.qh:17
+ Here is the call graph for this function:

◆ setDependent()

void setDependent ( entity  e,
string  theCvarName,
float  theCvarMin,
float  theCvarMax 
)

Definition at line 178 of file util.qc.

References func_null(), setDependent_Check(), setDependent_Draw(), and string_null.

179 {
180  e.draw_setDependent = e.draw;
181  e.cvar_setDependent = theCvarName;
182  e.cvarMin_setDependent = theCvarMin;
183  e.cvarMax_setDependent = theCvarMax;
184  e.cvar2_setDependent = string_null;
185  e.cvar3_setDependent = string_null;
186  e.func_setDependent = func_null;
187  e.draw = setDependent_Draw;
189 }
string string_null
Definition: nil.qh:9
var void func_null()
+ Here is the call graph for this function:

◆ setDependentAND()

void setDependentAND ( entity  e,
string  theCvarName,
float  theCvarMin,
float  theCvarMax,
string  theCvar2Name,
float  theCvar2Min,
float  theCvar2Max 
)

Definition at line 202 of file util.qc.

References func_null(), setDependent_Check(), setDependent_Draw(), and string_null.

203 {
204  e.draw_setDependent = e.draw;
205  e.cvar_setDependent = theCvarName;
206  e.cvarMin_setDependent = theCvarMin;
207  e.cvarMax_setDependent = theCvarMax;
208  e.cvar2_setDependent = theCvar2Name;
209  e.cvar2Min_setDependent = theCvar2Min;
210  e.cvar2Max_setDependent = theCvar2Max;
211  e.cvar3_setDependent = string_null;
212  e.op_setDependent = 0;
213  e.func_setDependent = func_null;
214  e.draw = setDependent_Draw;
216 }
string string_null
Definition: nil.qh:9
var void func_null()
+ Here is the call graph for this function:

◆ setDependentAND3()

void setDependentAND3 ( entity  e,
string  theCvarName,
float  theCvarMin,
float  theCvarMax,
string  theCvar2Name,
float  theCvar2Min,
float  theCvar2Max,
string  theCvar3Name,
float  theCvar3Min,
float  theCvar3Max 
)

Definition at line 232 of file util.qc.

References func_null(), setDependent_Check(), and setDependent_Draw().

233 {
234  e.draw_setDependent = e.draw;
235  e.cvar_setDependent = theCvarName;
236  e.cvarMin_setDependent = theCvarMin;
237  e.cvarMax_setDependent = theCvarMax;
238  e.cvar2_setDependent = theCvar2Name;
239  e.cvar2Min_setDependent = theCvar2Min;
240  e.cvar2Max_setDependent = theCvar2Max;
241  e.cvar3_setDependent = theCvar3Name;
242  e.cvar3Min_setDependent = theCvar3Min;
243  e.cvar3Max_setDependent = theCvar3Max;
244  e.op_setDependent = 0;
245  e.func_setDependent = func_null;
246  e.draw = setDependent_Draw;
248 }
var void func_null()
+ Here is the call graph for this function:

◆ setDependentOR()

void setDependentOR ( entity  e,
string  theCvarName,
float  theCvarMin,
float  theCvarMax,
string  theCvar2Name,
float  theCvar2Min,
float  theCvar2Max 
)

Definition at line 217 of file util.qc.

References func_null(), setDependent_Check(), setDependent_Draw(), and string_null.

218 {
219  e.draw_setDependent = e.draw;
220  e.cvar_setDependent = theCvarName;
221  e.cvarMin_setDependent = theCvarMin;
222  e.cvarMax_setDependent = theCvarMax;
223  e.cvar2_setDependent = theCvar2Name;
224  e.cvar2Min_setDependent = theCvar2Min;
225  e.cvar2Max_setDependent = theCvar2Max;
226  e.cvar3_setDependent = string_null;
227  e.op_setDependent = 1;
228  e.func_setDependent = func_null;
229  e.draw = setDependent_Draw;
231 }
string string_null
Definition: nil.qh:9
var void func_null()
+ Here is the call graph for this function:

◆ setDependentStringNotEqual()

void setDependentStringNotEqual ( entity  e,
string  theCvarName,
string  theCvarValue 
)

Definition at line 190 of file util.qc.

References func_null(), setDependent_Check(), setDependent_Draw(), and string_null.

191 {
192  e.draw_setDependent = e.draw;
193  e.cvarString_setDependent = theCvarName;
194  e.cvarValue_setDependent = theCvarValue;
195  e.cvar_setDependent = string_null;
196  e.cvar2_setDependent = string_null;
197  e.cvar3_setDependent = string_null;
198  e.func_setDependent = func_null;
199  e.draw = setDependent_Draw;
201 }
string string_null
Definition: nil.qh:9
var void func_null()
+ Here is the call graph for this function:

◆ setDependentWeird()

void setDependentWeird ( entity  e,
float(entity func 
)

Definition at line 249 of file util.qc.

References setDependent_Check(), and setDependent_Draw().

250 {
251  e.draw_setDependent = e.draw;
252  e.func_setDependent = func;
253  e.draw = setDependent_Draw;
255 }
+ Here is the call graph for this function:

◆ setZonedTooltip()

void setZonedTooltip ( entity  e,
string  theTooltip,
string  theCvar 
)

Definition at line 257 of file util.qc.

References prvm_language, strfree, string_null, and strzone().

Referenced by clearTooltip(), XonoticButton_configureXonoticButton(), XonoticCheckBox_configureXonoticCheckBox(), XonoticGametypeList_focusedItemChangeNotify(), XonoticInputBox_configureXonoticInputBox(), XonoticRadioButton_configureXonoticRadioButton(), XonoticRegisteredSettingsList_getTooltip_cb(), XonoticSlider_configureXonoticSlider(), and XonoticTextSlider_configureXonoticTextSlider().

258 {
259  if(theTooltip == "") // no tooltip, use cvar description then
260  {
261  if(theCvar != "" && prvm_language == "en")
262  {
263  string t = cvar_description(theCvar);
264  if(t != "" && t != "custom cvar")
265  theTooltip = t;
266  }
267  }
268  else if(theTooltip == "-") // no cvar description as tooltip
269  {
270  theTooltip = string_null;
271  }
272 
273  strfree(e.tooltip);
274  e.tooltip = (theTooltip != "") ? strzone(theTooltip) : string_null;
275 }
string string_null
Definition: nil.qh:9
string prvm_language
Definition: i18n.qh:8
#define strfree(this)
Definition: string.qh:56
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCompression()

float updateCompression ( )

Definition at line 628 of file util.qc.

References cvar_set(), fexists(), GL_Have_TextureCompression(), and LOG_INFO.

Referenced by m_init(), and m_sync().

629 {
630  float have_dds, have_jpg, have_tga;
631  float can_dds;
632  have_dds = (fexists("dds/particles/particlefont.dds"));
633  have_jpg = (fexists("particles/particlefont.jpg"));
634  have_tga = (fexists("particles/particlefont.tga"));
635  can_dds = GL_Have_TextureCompression();
636  if(have_dds && (have_jpg || have_tga))
637  {
638  // both? Let's only use good quality precompressed files
639  // but ONLY if we actually support it!
640  if(can_dds)
641  {
642  // these builds are meant to have GOOD quality, so let's not compress non-skinframes
643  cvar_set("gl_texturecompression", "0");
644  return 1;
645 
646  //cvar_set("gl_texturecompression", cvar_string("r_texture_dds_load"));
647  //return 2;
648  }
649  else
650  {
651  cvar_set("gl_texturecompression", "0");
652  cvar_set("r_texture_dds_load", "0");
653  return 0;
654  }
655  }
656  else if(have_dds)
657  {
658  // DDS only? We probably always want texture compression
659  cvar_set("gl_texturecompression", "1");
660  cvar_set("r_texture_dds_load", "1");
661  if(!can_dds)
662  LOG_INFO(_("^1ERROR: Texture compression is required but not supported.\n^1Expect visual problems."));
663  return 0;
664  }
665  else
666  {
667  // TGA only? Allow runtime compression
668  if(can_dds)
669  {
670  cvar_set("gl_texturecompression", cvar_string("r_texture_dds_load"));
671  return 2;
672  }
673  else
674  {
675  cvar_set("gl_texturecompression", "0");
676  cvar_set("r_texture_dds_load", "0");
677  return 0;
678  }
679  }
680 }
#define LOG_INFO(...)
Definition: log.qh:70
ERASEABLE bool fexists(string f)
Definition: file.qh:4
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateNotification_URI_Get_Callback()

void UpdateNotification_URI_Get_Callback ( float  id,
float  status,
string  data 
)

Definition at line 321 of file util.qc.

References APPEND_TO_STRING, argv(), cvar(), cvar_string(), LOG_INFO, LOG_TRACE, LOG_TRACEF, strstrofs, strzone(), substring(), tokenizebyseparator, and vercmp().

Referenced by URI_Get_Callback().

322 {
323  float n;
324 
326  {
327  LOG_TRACE("error: UpdateNotification_URI_Get_Callback has been called before");
328  return;
329  }
330  if(status != 0)
331  {
332  LOG_TRACEF("error receiving update notification: status is %d", status);
333  return;
334  }
335  if(substring(data, 0, 1) == "<")
336  {
337  LOG_TRACE("error: received HTML instead of an update notification");
338  return;
339  }
340  if(strstrofs(data, "\r", 0) != -1)
341  {
342  LOG_TRACE("error: received carriage returns from update notification server");
343  return;
344  }
345 
346  if(data == "")
347  n = 0;
348  else
349  n = tokenizebyseparator(data, "\n");
350 
351  float i;
352  string s;
353 
354  string un_version = "";
355  string un_tosversion = "";
356  string un_download = "";
357  string un_url = "";
358  string un_bannedservers = "";
359  string un_emergency_pk3s = "";
360  string un_promoted = "";
361  string un_recommended = "";
362  string un_compatexpire = "";
363 
364  for(i = 0; i < n; ++i)
365  {
366  s = substring(argv(i), 2, -1);
367  if(s == "") { continue; } // ignore empty lines
368 
369  switch(substring(argv(i), 0, 1))
370  {
371  case "V":
372  {
373  un_version = s;
374  break;
375  }
376  case "T":
377  {
378  un_tosversion = s;
379  break;
380  }
381  case "C":
382  {
383  un_compatexpire = s;
384  break;
385  }
386  case "D":
387  {
388  un_download = s;
389  break;
390  }
391  case "U":
392  {
393  un_url = s;
394  break;
395  }
396  case "B":
397  {
398  APPEND_TO_STRING(un_bannedservers, " ", s);
399  break;
400  }
401  case "E":
402  {
403  if(cvar("menu_updatecheck_getpacks"))
404  APPEND_TO_STRING(un_emergency_pk3s, " ", s);
405  break;
406  }
407  case "P":
408  {
409  APPEND_TO_STRING(un_promoted, " ", s);
410  break;
411  }
412  case "R":
413  {
414  APPEND_TO_STRING(un_recommended, " ", s);
415  break;
416  }
417  }
418  }
419 
420  if(un_version != "")
421  {
422  if(vercmp(cvar_string("g_xonoticversion"), un_version) < 0)
423  {
424  // update needed
426  if(un_download) { LOG_INFO(_("Update can be downloaded at:"), "\n", un_download); }
427  if(un_url) { _Nex_ExtResponseSystem_UpdateToURL = strzone(un_url); }
429  }
430  else if(cvar_string("g_xonoticversion") == un_version)
431  {
432  if(un_compatexpire != "")
433  {
434  string curdate = strftime(false, "%Y%m%d%H%M%S");
435  if (strcmp(curdate, un_compatexpire) >= 0)
437  }
438  }
439  }
440 
441  if(un_tosversion != "")
442  {
443  _Nex_ExtResponseSystem_NewToS = stof(un_tosversion);
444  }
445 
446  if(un_bannedservers != "")
447  {
448  _Nex_ExtResponseSystem_BannedServers = strzone(un_bannedservers);
450  }
451 
452  if(un_emergency_pk3s != "")
453  {
454  _Nex_ExtResponseSystem_Packs = strzone(un_emergency_pk3s);
456  }
457 
458  if(un_promoted != "")
459  {
462  }
463 
464  if(un_recommended != "")
465  {
468  }
469 }
#define APPEND_TO_STRING(list, sep, add)
Definition: util.qh:225
#define strcmp
Definition: dpextensions.qh:51
ERASEABLE int vercmp(string v1, string v2)
Definition: string.qh:488
#define LOG_INFO(...)
Definition: log.qh:70
#define LOG_TRACEF(...)
Definition: log.qh:82
#define strstrofs
Definition: dpextensions.qh:42
#define LOG_TRACE(...)
Definition: log.qh:81
#define tokenizebyseparator
Definition: dpextensions.qh:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ _Nex_ExtResponseSystem_BannedServers

string _Nex_ExtResponseSystem_BannedServers

Definition at line 44 of file util.qh.

Referenced by XonoticServerList_refreshServerList().

◆ _Nex_ExtResponseSystem_BannedServersNeedsRefresh

float _Nex_ExtResponseSystem_BannedServersNeedsRefresh

Definition at line 45 of file util.qh.

Referenced by XonoticServerList_draw().

◆ _Nex_ExtResponseSystem_NewToS

float _Nex_ExtResponseSystem_NewToS

Definition at line 50 of file util.qh.

Referenced by Close_Clicked(), and XonoticToSDialog_shouldShow().

◆ _Nex_ExtResponseSystem_PromotedServers

string _Nex_ExtResponseSystem_PromotedServers

Definition at line 46 of file util.qh.

◆ _Nex_ExtResponseSystem_PromotedServersNeedsRefresh

float _Nex_ExtResponseSystem_PromotedServersNeedsRefresh

Definition at line 47 of file util.qh.

Referenced by XonoticServerList_draw().

◆ _Nex_ExtResponseSystem_RecommendedServers

string _Nex_ExtResponseSystem_RecommendedServers

Definition at line 48 of file util.qh.

◆ _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh

float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh

Definition at line 49 of file util.qh.

Referenced by XonoticServerList_draw().