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.

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)
 float (entity) func_setDependent
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)
bool GL_CheckExtension (string ext)
bool GL_Have_TextureCompression ()
bool isServerSingleplayer ()
void loadAllCvars (entity root)
void makeCallback (entity me, entity cbent, void(entity, entity) cbfunc)
void makeMulti (entity me, string otherCvars)
void makeServerSingleplayer ()
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)
void setDependentNOT (entity e, string theCvarName, float theCvarValue)
void setDependentOR (entity e, string theCvarName, float theCvarMin, float theCvarMax)
void setDependentStringNotEqual (entity e, string theCvarName, string theCvarValue)
void setDependentWeird (entity e, float(entity) func)
void setZonedTooltip (entity e, string theTooltip, string theCvar)
void 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
string cvar1_setDependent
float cvar1Max_setDependent
float cvar1Min_setDependent
string cvar2_setDependent
float cvar2Max_setDependent
float cvar2Min_setDependent
string cvar3_setDependent
float cvar3Max_setDependent
float cvar3Min_setDependent
string cvarString_setDependent
string cvarValue_setDependent
bool disabled
int op_setDependent

Function Documentation

◆ CheckSendCvars()

void CheckSendCvars ( entity me,
string cvarnamestring )

Definition at line 825 of file util.qc.

826{
827 if(me.sendCvars)
828 {
830 {
831 LOG_INFOF("Sending cvar: %s -> %s", cvarnamestring, cvar_string(cvarnamestring));
832 localcmd(sprintf("\nsendcvar %s\n", cvarnamestring));
833 }
834 }
835}
#define LOG_INFOF(...)
Definition log.qh:66
const int GAME_ISSERVER
Definition menu.qh:11
const int GAME_CONNECTED
Definition menu.qh:12
int gamestatus
Definition menu.qh:16
void localcmd(string command,...)
const string cvar_string(string name)

References cvar_string(), entity(), GAME_CONNECTED, GAME_ISSERVER, gamestatus, localcmd(), and LOG_INFOF.

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

◆ clearTooltip()

◆ dialog_hudpanel_main_checkbox()

void dialog_hudpanel_main_checkbox ( entity me,
string panelname )

Definition at line 722 of file util.qc.

723{
724 entity e;
725
726 me.TR(me);
727 me.TDempty(me, 1.5);
728 me.TD(me, 1, 2.5, e = makeXonoticCheckBox(0, strzone(strcat("hud_panel_", panelname)), _("Enable")));
729}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
entity makeXonoticCheckBox(float, string, string)
Definition checkbox.qc:28
string strzone(string s)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

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

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

◆ dialog_hudpanel_main_settings()

void dialog_hudpanel_main_settings ( entity me,
string panelname )

Definition at line 731 of file util.qc.

732{
733 float i;
734 entity e;
735
736 me.gotoRC(me, me.currentRow + 1.5, 0);
737 me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Background:")));
738 me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg"))));
739 e.setValueSpace(e, e.valueSpace * 1.25);
740 e.addValue(e, _("Default"), "");
741 e.addValue(e, _("Disable"), "0");
742 e.addValue(e, strzone(strcat("border_", panelname)), strzone(strcat("border_", panelname)));
743 e.configureXonoticTextSliderValues(e);
744 me.TR(me);
745 me.TDempty(me, 0.2);
746 me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Color:")));
747 setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_bg")), "0");
748 me.TD(me, 2, 2.6, e = makeXonoticColorpickerString(strzone(strcat("hud_panel_", panelname, "_bg_color")), "hud_panel_bg_color"));
749 setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_bg_color")), "");
750 me.TR(me);
751 me.TDempty(me, 0.4);
752 me.TD(me, 1, 3.6, e = makeXonoticCheckBoxString("", "1 1 1", strzone(strcat("hud_panel_", panelname, "_bg_color")), _("Default")));
753 me.TR(me);
754 me.TDempty(me, 0.2);
755 me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Border size:")));
756 me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_border"))));
757 e.addValue(e, _("Default"), "");
758 e.addValue(e, _("Disable"), "0");
759 for(i = 1; i <= 10; ++i)
760 e.addValue(e, strzone(ftos_decimals(i * 2, 0)), strzone(ftos(i * 2)));
761 e.configureXonoticTextSliderValues(e);
762 me.TR(me);
763 me.TDempty(me, 0.2);
764 me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Opacity:")));
765 me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_alpha"))));
766 e.addValue(e, _("Default"), "");
767 for(i = 1; i <= 20; ++i)
768 e.addValue(e, strzone(ftos_decimals_percentage(i / 20, 0)), strzone(ftos_mindecimals(i / 20)));
769 e.configureXonoticTextSliderValues(e);
770 me.TR(me);
771 me.TDempty(me, 0.2);
772 me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Team color:")));
773 setDependentNOT(e, strzone(strcat("hud_panel_", panelname, "_bg_alpha")), 0);
774 me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_color_team"))));
775 e.addValue(e, _("Default"), "");
776 e.addValue(e, _("Disable"), "0");
777 for(i = 1; i <= 10; ++i)
778 e.addValue(e, strzone(ftos_decimals_percentage(i / 10, 0)), strzone(ftos_mindecimals(i / 10)));
779 e.configureXonoticTextSliderValues(e);
780 setDependentNOT(e, strzone(strcat("hud_panel_", panelname, "_bg_alpha")), 0);
781 me.TR(me);
782 me.TDempty(me, 0.4);
783 me.TD(me, 1, 3.6, e = makeXonoticCheckBox(0, "hud_configure_teamcolorforced", _("Test team color in configure mode")));
784 me.TR(me);
785 me.TDempty(me, 0.2);
786 me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Padding:")));
787 me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_padding"))));
788 e.addValue(e, _("Default"), "");
789 for(i = 0; i <= 10; ++i)
790 e.addValue(e, strzone(ftos_decimals(i - 5, 0)), strzone(ftos(i - 5)));
791 e.configureXonoticTextSliderValues(e);
792
793 string hide_ondeath = strcat("hud_panel_", panelname, "_hide_ondeath");
794 if(cvar_type(hide_ondeath) & CVAR_TYPEFLAG_EXISTS)
795 {
796 me.TR(me);
797 me.TDempty(me, 0.2);
798 me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, strzone(hide_ondeath), _("Hide on death")));
799 }
800
801 me.gotoRC(me, me.currentRow + 0.5, 0); me.setFirstColumn(me, me.currentColumn);
802}
float CVAR_TYPEFLAG_EXISTS
entity makeXonoticTextLabel(float theAlign, string theText)
Definition textlabel.qc:3
void setDependentStringNotEqual(entity e, string theCvarName, string theCvarValue)
Definition util.qc:204
entity makeXonoticTextSlider(string)
Definition textslider.qc:10
entity makeXonoticCheckBoxString(string, string, string, string)
void setDependentNOT(entity e, string theCvarName, float theCvarValue)
Definition util.qc:192
entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar)
string ftos(float f)
ERASEABLE string ftos_decimals(float number, int decimals)
converts a number to a string with the indicated number of decimals
Definition string.qh:469
ERASEABLE string ftos_mindecimals(float number)
Converts a number to a string with the minimum number of decimals It assumes that an extreme accuracy...
Definition string.qh:497
ERASEABLE string ftos_decimals_percentage(float number, int decimals)
converts a percentage to a string with the indicated number of decimals
Definition string.qh:480

References CVAR_TYPEFLAG_EXISTS, entity(), ftos(), ftos_decimals(), ftos_decimals_percentage(), ftos_mindecimals(), makeXonoticCheckBox(), makeXonoticCheckBoxString(), makeXonoticColorpickerString(), makeXonoticTextLabel(), makeXonoticTextSlider(), setDependentNOT(), setDependentStringNotEqual(), strcat(), and strzone().

Referenced by XonoticHUDAmmoDialog_fill(), XonoticHUDCenterprintDialog_fill(), XonoticHUDChatDialog_fill(), XonoticHUDCheckpointsDialog_fill(), XonoticHUDEngineInfoDialog_fill(), XonoticHUDHealthArmorDialog_fill(), XonoticHUDInfoMessagesDialog_fill(), XonoticHUDItemsTimeDialog_fill(), XonoticHUDModIconsDialog_fill(), XonoticHUDNotificationDialog_fill(), XonoticHUDPhysicsDialog_fill(), XonoticHUDPickupDialog_fill(), XonoticHUDPowerupsDialog_fill(), XonoticHUDPressedKeysDialog_fill(), XonoticHUDQuickMenuDialog_fill(), XonoticHUDRaceTimerDialog_fill(), XonoticHUDRadarDialog_fill(), XonoticHUDScoreDialog_fill(), XonoticHUDStrafeHUDDialog_fill(), XonoticHUDTimerDialog_fill(), XonoticHUDVoteDialog_fill(), and XonoticHUDWeaponsDialog_fill().

◆ float()

float ( entity )

References entity().

◆ forAllDescendants()

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

Definition at line 26 of file util.qc.

27{
28 depthfirst(root, parent, firstChild, nextSibling, funcPre, funcPost, pass);
29}
entity parent
Definition animhost.qc:7
void depthfirst(entity start,.entity up,.entity downleft,.entity right, void(entity, entity) funcPre, void(entity, entity) funcPost, entity pass)
Definition util.qc:393
#define pass(name, colormin, colormax)
entity nextSibling
Definition menu_cmd.qc:12
entity firstChild
Definition menu_cmd.qc:12

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

Referenced by loadAllCvars(), and saveAllCvars().

◆ GameType_GetCount()

int GameType_GetCount ( )

Definition at line 674 of file util.qc.

675{
676 int i = 0;
677 bool showall = autocvar_menu_create_show_all;
678 #define GAMETYPE(id) ++i;
680 #undef GAMETYPE
681 #define GAMETYPE(it) { if (showall) ++i; }
683 #undef GAMETYPE
684 return i;
685}
bool autocvar_menu_create_show_all
#define GAMETYPES
Definition util.qc:637
#define HIDDEN_GAMETYPES
Definition util.qc:658

References autocvar_menu_create_show_all, GAMETYPES, and HIDDEN_GAMETYPES.

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

◆ GameType_GetIcon()

string GameType_GetIcon ( int cnt)

Definition at line 703 of file util.qc.

704{
706 return i ? strcat("gametype_", MapInfo_Type_ToString(i)) : "";
707}
float cnt
Definition powerups.qc:24
string MapInfo_Type_ToString(Gametype t)
Definition mapinfo.qc:656
Gametype GameType_GetID(int cnt)
Definition util.qc:664

References cnt, GameType_GetID(), MapInfo_Type_ToString(), and strcat().

Referenced by XonoticGametypeList_configureXonoticGametypeList(), and XonoticGametypeList_drawListBoxItem().

◆ GameType_GetID()

entity GameType_GetID ( int cnt)

Definition at line 664 of file util.qc.

665{
666 int i = 0;
667 #define GAMETYPE(it) { if (i++ == cnt) return it; }
670 #undef GAMETYPE
671 return NULL;
672}
#define NULL
Definition post.qh:14

References cnt, GAMETYPES, HIDDEN_GAMETYPES, and NULL.

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

◆ GameType_GetName()

string GameType_GetName ( int cnt)

Definition at line 697 of file util.qc.

698{
700 return i ? MapInfo_Type_ToText(i) : "";
701}
string MapInfo_Type_ToText(Gametype t)
Definition mapinfo.qc:661

References cnt, GameType_GetID(), and MapInfo_Type_ToText().

Referenced by XonoticGametypeList_drawListBoxItem().

◆ GameType_GetTotalCount()

int GameType_GetTotalCount ( )

Definition at line 687 of file util.qc.

688{
689 int i = 0;
690 #define GAMETYPE(id) ++i;
693 #undef GAMETYPE
694 return i;
695}

References GAMETYPES, and HIDDEN_GAMETYPES.

Referenced by XonoticGametypeList_configureXonoticGametypeList(), XonoticMapInfoDialog_fill(), and XonoticMapInfoDialog_loadMapInfo().

◆ getCvarsMulti()

string getCvarsMulti ( entity me)

Definition at line 60 of file util.qc.

61{
62 if (me.controlledCvars_Multi)
63 return me.controlledCvars_Multi;
64 return string_null;
65}

References entity(), and string_null.

Referenced by gettooltip().

◆ getFadedAlpha()

◆ GL_CheckExtension()

bool GL_CheckExtension ( string ext)

Definition at line 15 of file util.qc.

16{
17 return strhasword(cvar_string("gl_info_extensions"), ext);
18}
#define strhasword(s, w)
Definition string.qh:370

References cvar_string(), and strhasword.

Referenced by GL_Have_TextureCompression().

◆ GL_Have_TextureCompression()

bool GL_Have_TextureCompression ( )

Definition at line 20 of file util.qc.

21{
22 return GL_CheckExtension("GL_EXT_texture_compression_s3tc");
23}
bool GL_CheckExtension(string ext)
Definition util.qc:15

References GL_CheckExtension().

Referenced by updateCompression(), XonoticEffectsSettingsTab_fill(), and XonoticPicmipSlider_configureXonoticPicmipSlider().

◆ isServerSingleplayer()

bool isServerSingleplayer ( )

Definition at line 804 of file util.qc.

805{
806 return (cvar_string("net_address") == "127.0.0.1" && cvar_string("net_address_ipv6") == "::1");
807}

References cvar_string().

Referenced by leaveMatchButton_getText(), and leaveMatchButton_getTooltip().

◆ loadAllCvars()

◆ makeCallback()

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

Definition at line 107 of file util.qc.

108{
109 e.saveCvars_Callback = e.saveCvars;
110 e.saveCvars = saveCvarsCallback;
111 e.saveCvars_Callback_ent = cbent;
112 e.saveCvars_Callback_func = cbfunc;
113}
void saveCvarsCallback(entity me)
Definition util.qc:102

References entity(), and saveCvarsCallback().

Referenced by XonoticServerCreateTab_fill().

◆ makeMulti()

◆ makeServerSingleplayer()

void makeServerSingleplayer ( )

Definition at line 809 of file util.qc.

810{
811 // it doesn't allow clients to connect from different machines
812 localcmd("defer 0.1 \"sv_cmd settemp net_address 127.0.0.1\"\n");
813 localcmd("defer 0.1 \"sv_cmd settemp net_address_ipv6 ::1\"\n");
814}

References localcmd().

Referenced by CampaignSetup(), and InstantAction_LoadMap().

◆ resolvemod()

string resolvemod ( string m)

Definition at line 596 of file util.qc.

597{
598 if(m == "=")
599 return getcurrentmod();
600 else
601 return m;
602}
string getcurrentmod()
Definition util.qc:1327

References getcurrentmod().

Referenced by XonoticServerList_refreshServerList().

◆ saveAllCvars()

void saveAllCvars ( entity root)

Definition at line 49 of file util.qc.

50{
52}
void saveCvarsOf(entity ignore, entity e)
Definition util.qc:37

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

◆ setDependent()

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

◆ setDependentAND()

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

Definition at line 213 of file util.qc.

214{
215 if (e.cvar2_setDependent)
216 {
217 e.cvar3_setDependent = theCvarName;
218 e.cvar3Min_setDependent = theCvarMin;
219 e.cvar3Max_setDependent = theCvarMax;
220 }
221 else
222 {
223 e.cvar2_setDependent = theCvarName;
224 e.cvar2Min_setDependent = theCvarMin;
225 e.cvar2Max_setDependent = theCvarMax;
226 }
227 e.op_setDependent &= ~BIT(0); // AND
228 e.func_setDependent = func_null;
230}
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8

References BIT, entity(), func_null(), and setDependent_Check().

Referenced by XonoticDamageTextSettings_fill(), XonoticEffectsSettingsTab_fill(), XonoticGameCrosshairSettingsTab_fill(), XonoticGameHUDSettingsTab_fill(), XonoticGameMessageSettingsTab_fill(), XonoticGameViewSettingsTab_fill(), XonoticGameWeaponsSettingsTab_fill(), XonoticHUDAmmoDialog_fill(), XonoticHUDStrafeHUDDialog_fill(), XonoticHUDWeaponsDialog_fill(), and XonoticServerCreateTab_fill().

◆ setDependentNOT()

◆ setDependentOR()

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

Definition at line 231 of file util.qc.

232{
233 if (e.cvar2_setDependent)
234 {
235 e.cvar3_setDependent = theCvarName;
236 e.cvar3Min_setDependent = theCvarMin;
237 e.cvar3Max_setDependent = theCvarMax;
238 }
239 else
240 {
241 e.cvar2_setDependent = theCvarName;
242 e.cvar2Min_setDependent = theCvarMin;
243 e.cvar2Max_setDependent = theCvarMax;
244 }
245 e.op_setDependent |= BIT(0); // OR
246 e.func_setDependent = func_null;
248}

References BIT, entity(), func_null(), and setDependent_Check().

Referenced by XonoticEffectsSettingsTab_fill(), and XonoticHUDPhysicsDialog_fill().

◆ setDependentStringNotEqual()

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

Definition at line 204 of file util.qc.

205{
206 e.draw_setDependent = e.draw;
207 e.cvarString_setDependent = theCvarName;
208 e.cvarValue_setDependent = theCvarValue;
209 e.func_setDependent = func_null;
210 e.draw = setDependent_Draw;
212}

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

Referenced by dialog_hudpanel_main_settings().

◆ setDependentWeird()

void setDependentWeird ( entity e,
float(entity) func )

Definition at line 249 of file util.qc.

250{
251 e.draw_setDependent = e.draw;
252 e.func_setDependent = func;
253 e.draw = setDependent_Draw;
255}

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

Referenced by XonoticEffectsSettingsTab_fill(), XonoticFirstRunDialog_fill(), and XonoticMutatorsDialog_fill().

◆ setZonedTooltip()

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

Definition at line 257 of file util.qc.

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 prvm_language
Definition i18n.qh:8
#define strfree(this)
Definition string.qh:59

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

Referenced by clearTooltip(), XonoticRegisteredSettingsList::focusedItemChangeNotify(), ServerList_Update_favoriteButton(), XonoticButton_configureXonoticButton(), XonoticCheckBox_configureXonoticCheckBox(), XonoticGametypeList_focusedItemChangeNotify(), XonoticInputBox_configureXonoticInputBox(), XonoticLanguageList_focusedItemChangeNotify(), XonoticLeaveMatchButton_draw(), XonoticMixedSlider_configureXonoticMixedSlider(), XonoticRadioButton_configureXonoticRadioButton(), XonoticServerInfoDialog_loadServerInfo(), XonoticServerList_drawListBoxItem(), XonoticSlider_configureXonoticSlider(), and XonoticTextSlider_configureXonoticTextSlider().

◆ updateCompression()

void updateCompression ( )

Definition at line 604 of file util.qc.

605{
606 bool have_dds = (fexists("dds/particles/particlefont.dds"));
607 bool have_jpg = (fexists("particles/particlefont.jpg"));
608 bool have_tga = (fexists("particles/particlefont.tga"));
609 bool can_dds = GL_Have_TextureCompression();
610
611 if (!can_dds)
612 cvar_set("gl_texturecompression", "0");
613
614 if(have_dds && (have_jpg || have_tga))
615 {
616 // both? Let's only use good quality precompressed files
617 // but ONLY if we actually support it!
618 // bones_was_here: quality settings moved to effects configs and menu
619 }
620 else if(have_dds)
621 {
622 // DDS only? We _must_ load DDS files!
623 cvar_set("r_texture_dds_load", "1");
624 if(!can_dds)
625 {
626 cvar_set("r_texture_dds_swdecode", "1");
627 LOG_WARN(_("^1ERROR: Texture compression is required but not supported.\n^1Expect visual problems."));
628 }
629 }
630 else
631 {
632 // TGA only? Allow runtime compression
633 }
634}
ERASEABLE bool fexists(string f)
Definition file.qh:4
#define LOG_WARN(...)
Definition log.qh:61
bool GL_Have_TextureCompression()
Definition util.qc:20
void cvar_set(string name, string value)

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

Referenced by m_init(), and m_sync().

◆ UpdateNotification_URI_Get_Callback()

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

Definition at line 316 of file util.qc.

317{
318 float n;
319
321 {
322 LOG_TRACE("error: UpdateNotification_URI_Get_Callback has been called before");
323 return;
324 }
325 if(status != 0)
326 {
327 LOG_TRACEF("error receiving update notification: status is %d", status);
328 return;
329 }
330 if(substring(data, 0, 1) == "<")
331 {
332 LOG_TRACE("error: received HTML instead of an update notification");
333 return;
334 }
335 if(strstrofs(data, "\r", 0) != -1)
336 {
337 LOG_TRACE("error: received carriage returns from update notification server");
338 return;
339 }
340
341 if(data == "")
342 n = 0;
343 else
344 n = tokenizebyseparator(data, "\n");
345
346 float i;
347 string s;
348
349 string un_version = "";
350 string un_tosversion = "";
351 string un_download = "";
352 string un_url = "";
353 string un_bannedservers = "";
354 string un_emergency_pk3s = "";
355 string un_promoted = "";
356 string un_recommended = "";
357 string un_compatexpire = "";
358
359 for(i = 0; i < n; ++i)
360 {
361 s = substring(argv(i), 2, -1);
362 if(s == "") { continue; } // ignore empty lines
363
364 switch(substring(argv(i), 0, 1))
365 {
366 case "V":
367 {
368 un_version = s;
369 break;
370 }
371 case "T":
372 {
373 un_tosversion = s;
374 break;
375 }
376 case "C":
377 {
378 un_compatexpire = s;
379 break;
380 }
381 case "D":
382 {
383 un_download = s;
384 break;
385 }
386 case "U":
387 {
388 un_url = s;
389 break;
390 }
391 case "B":
392 {
393 APPEND_TO_STRING(un_bannedservers, " ", s);
394 break;
395 }
396 case "H":
397 {
398 // Hotfix (version-specific pk3 supported in >= 0.8.6)
399 // replaces "E" (missing-file-specific pk3 supported in <= 0.8.5)
400 APPEND_TO_STRING(un_emergency_pk3s, " ", s);
401 break;
402 }
403 case "P":
404 {
405 APPEND_TO_STRING(un_promoted, " ", s);
406 break;
407 }
408 case "R":
409 {
410 APPEND_TO_STRING(un_recommended, " ", s);
411 break;
412 }
413 }
414 }
415
416 if(un_version != "" && vercmp(cvar_string("g_xonoticversion"), un_version) < 0)
417 {
418 // update needed
420 if(un_download) { LOG_INFO(_("Update can be downloaded at:"), "\n", un_download); }
421 if(un_url) { _Nex_ExtResponseSystem_UpdateToURL = strzone(un_url); }
422 }
423
424 if(un_tosversion != "")
425 {
426 _Nex_ExtResponseSystem_NewToS = stof(un_tosversion);
427 }
428
429 if(un_bannedservers != "")
430 {
433 }
434
435 if(un_emergency_pk3s != "")
436 {
437 _Nex_ExtResponseSystem_Packs = strzone(un_emergency_pk3s);
439 }
440
441 if(un_promoted != "")
442 {
445 }
446
447 if(un_recommended != "")
448 {
451 }
452}
#define APPEND_TO_STRING(list, sep, add)
Definition util.qh:265
#define strstrofs
#define tokenizebyseparator
#define LOG_TRACEF(...)
Definition log.qh:77
#define LOG_INFO(...)
Definition log.qh:65
#define LOG_TRACE(...)
Definition log.qh:76
string _Nex_ExtResponseSystem_Packs
Definition util.qc:287
string _Nex_ExtResponseSystem_UpdateToURL
Definition util.qc:286
float _Nex_ExtResponseSystem_PacksStep
Definition util.qc:288
string _Nex_ExtResponseSystem_UpdateTo
Definition util.qc:285
float _Nex_ExtResponseSystem_BannedServersNeedsRefresh
Definition util.qh:63
float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh
Definition util.qh:67
string _Nex_ExtResponseSystem_BannedServers
Definition util.qh:62
string _Nex_ExtResponseSystem_PromotedServers
Definition util.qh:64
float _Nex_ExtResponseSystem_NewToS
Definition util.qh:68
string _Nex_ExtResponseSystem_RecommendedServers
Definition util.qh:66
float _Nex_ExtResponseSystem_PromotedServersNeedsRefresh
Definition util.qh:65
float stof(string val,...)
string substring(string s, float start, float length)
string argv(float n)
ERASEABLE int vercmp(string v1, string v2)
Definition string.qh:557

References _Nex_ExtResponseSystem_BannedServers, _Nex_ExtResponseSystem_BannedServersNeedsRefresh, _Nex_ExtResponseSystem_NewToS, _Nex_ExtResponseSystem_Packs, _Nex_ExtResponseSystem_PacksStep, _Nex_ExtResponseSystem_PromotedServers, _Nex_ExtResponseSystem_PromotedServersNeedsRefresh, _Nex_ExtResponseSystem_RecommendedServers, _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh, _Nex_ExtResponseSystem_UpdateTo, _Nex_ExtResponseSystem_UpdateToURL, APPEND_TO_STRING, argv(), cvar_string(), LOG_INFO, LOG_TRACE, LOG_TRACEF, stof(), strstrofs, strzone(), substring(), tokenizebyseparator, and vercmp().

Referenced by URI_Get_Callback().

Variable Documentation

◆ _Nex_ExtResponseSystem_BannedServers

string _Nex_ExtResponseSystem_BannedServers

◆ _Nex_ExtResponseSystem_BannedServersNeedsRefresh

float _Nex_ExtResponseSystem_BannedServersNeedsRefresh

Definition at line 63 of file util.qh.

Referenced by UpdateNotification_URI_Get_Callback(), and XonoticServerList_draw().

◆ _Nex_ExtResponseSystem_NewToS

float _Nex_ExtResponseSystem_NewToS

◆ _Nex_ExtResponseSystem_PromotedServers

string _Nex_ExtResponseSystem_PromotedServers

Definition at line 64 of file util.qh.

Referenced by UpdateNotification_URI_Get_Callback().

◆ _Nex_ExtResponseSystem_PromotedServersNeedsRefresh

float _Nex_ExtResponseSystem_PromotedServersNeedsRefresh

Definition at line 65 of file util.qh.

Referenced by UpdateNotification_URI_Get_Callback(), and XonoticServerList_draw().

◆ _Nex_ExtResponseSystem_RecommendedServers

string _Nex_ExtResponseSystem_RecommendedServers

Definition at line 66 of file util.qh.

Referenced by UpdateNotification_URI_Get_Callback().

◆ _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh

float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh

Definition at line 67 of file util.qh.

Referenced by UpdateNotification_URI_Get_Callback(), and XonoticServerList_draw().

◆ cvar1_setDependent

string cvar1_setDependent

Definition at line 3 of file util.qh.

Referenced by gettooltip().

◆ cvar1Max_setDependent

float cvar1Max_setDependent

Definition at line 5 of file util.qh.

Referenced by gettooltip().

◆ cvar1Min_setDependent

float cvar1Min_setDependent

Definition at line 4 of file util.qh.

Referenced by gettooltip().

◆ cvar2_setDependent

string cvar2_setDependent

Definition at line 6 of file util.qh.

Referenced by gettooltip().

◆ cvar2Max_setDependent

float cvar2Max_setDependent

Definition at line 8 of file util.qh.

Referenced by gettooltip().

◆ cvar2Min_setDependent

float cvar2Min_setDependent

Definition at line 7 of file util.qh.

Referenced by gettooltip().

◆ cvar3_setDependent

string cvar3_setDependent

Definition at line 9 of file util.qh.

Referenced by gettooltip().

◆ cvar3Max_setDependent

float cvar3Max_setDependent

Definition at line 11 of file util.qh.

Referenced by gettooltip().

◆ cvar3Min_setDependent

float cvar3Min_setDependent

Definition at line 10 of file util.qh.

Referenced by gettooltip().

◆ cvarString_setDependent

string cvarString_setDependent

Definition at line 13 of file util.qh.

◆ cvarValue_setDependent

string cvarValue_setDependent

Definition at line 14 of file util.qh.

◆ disabled

bool disabled

Definition at line 16 of file util.qh.

◆ op_setDependent

int op_setDependent

Definition at line 12 of file util.qh.