noref int autocvar_developer;
noref bool autocvar_prvm_backtraceforwarnings;
-#ifdef SVQC
-#define bt_cvar_set(cvar, value) builtin_cvar_set(cvar, value)
-#else
-#define bt_cvar_set(cvar, value) cvar_set(cvar, value)
-#endif
-
#define backtrace(msg) \
MACRO_BEGIN \
int dev = autocvar_developer; \
bool war = autocvar_prvm_backtraceforwarnings; \
- bt_cvar_set("developer", "1"); \
- bt_cvar_set("prvm_backtraceforwarnings", "1"); \
+ cvar_set("developer", "1"); \
+ cvar_set("prvm_backtraceforwarnings", "1"); \
print("\n--- CUT HERE ---\n", msg); \
_backtrace(); \
print("\n--- CUT UNTIL HERE ---\n"); \
- bt_cvar_set("developer", ftos(dev)); \
- bt_cvar_set("prvm_backtraceforwarnings", ftos(war)); \
+ cvar_set("developer", ftos(dev)); \
+ cvar_set("prvm_backtraceforwarnings", ftos(war)); \
MACRO_END
void print_assertfailed_severe(string expr)
float CampaignBailout(string s)
{
-#if 0
- cvar = cvar_normal;
- cvar_string = cvar_string_normal;
- cvar_set = cvar_set_normal;
-#endif
cvar_set("g_campaign", "0");
LOG_INFO("^4campaign initialization failed: ", s);
if(autocvar__campaign_testrun)
return 1;
}
-#if 0
-string cvar_campaignwrapper_list; // string of format ; var value; var value; var value;
-string cvar_string_campaignwrapper(string theCvar)
-{
- float p, q;
- p = strstrofs(cvar_campaignwrapper_list, strcat("; ", theCvar, " "), 0);
- if(p < 0)
- return cvar_defstring(theCvar);
- p += strlen(theCvar) + 3;
- q = strstrofs(cvar_campaignwrapper_list, ";", p);
- if(q < 0)
- return cvar_defstring(theCvar);
- return substring(cvar_campaignwrapper_list, p, q - p);
-}
-float cvar_campaignwrapper(string theCvar)
-{
- return stof(cvar_string_campaignwrapper(theCvar));
-}
-void cvar_set_campaignwrapper(string theCvar, string theValue)
-{
- if(cvar_string_campaignwrapper(theCvar) == theValue)
- return;
- string s = cvar_campaignwrapper_list;
- cvar_campaignwrapper_list = strzone(strcat("; ", theCvar, " ", theValue, s));
- strunzone(s);
- //print(cvar_campaignwrapper_list, "\n");
-}
-#endif
-
float Campaign_Invalid()
{
string thismapname, wantedmapname;
cvar_set("sv_public", "0");
cvar_set("pausable", "1");
-#if 0
- cvar_campaignwrapper_list = strzone(strcat("; ", campaign_mutators[0], "; "));
-#else
string cvar_campaignwrapper_list = strcat("; ", campaign_mutators[0], "; ");
int argc = tokenizebyseparator(cvar_campaignwrapper_list, "; ");
if(argc > 0)
_MapInfo_Parse_Settemp(mapname, MAPINFO_SETTEMP_ACL_USER, 0, arg, 1);
}
}
-#endif
-
-#if 0
- cvar = cvar_campaignwrapper;
- cvar_string = cvar_string_campaignwrapper;
- cvar_set = cvar_set_campaignwrapper;
- cvar_set("g_campaign", "1");
- cvar_set("g_dm", "0");
- cvar_set("skill", ftos(baseskill));
- cvar_set("bot_number", ftos(campaign_bots[0]));
-#else
+
cvar_settemp("g_campaign", "1");
cvar_settemp("g_dm", "0");
cvar_settemp("skill", ftos(baseskill));
cvar_settemp("bot_number", ftos(campaign_bots[0]));
-#endif
- MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0]));
- // copy sv_gravity cvar, as the engine needs it too (sorry, this will mess
- // with the menu a little still...)
- cvar_set_normal("sv_gravity", ftos(autocvar_sv_gravity));
+ MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0]));
if(Campaign_Invalid())
return;
cvar_set("fraglimit", "0");
cvar_set("leadlimit", "0");
cvar_set("timelimit", "0.01");
- cvar_set_normal("fraglimit", "0");
- cvar_set_normal("leadlimit", "0");
- cvar_set_normal("timelimit", "0.01");
}
else
{
tokenizebyseparator(campaign_fraglimit[0], "+");
if(argv(0) != "default") {
cvar_set("fraglimit", argv(0));
- cvar_set_normal("fraglimit", argv(0));
}
if(argv(1) != "default") {
cvar_set("leadlimit", argv(1));
- cvar_set_normal("leadlimit", argv(1));
}
if(campaign_timelimit[0] != "default") {
cvar_set("timelimit", campaign_timelimit[0]);
- cvar_set_normal("timelimit", campaign_timelimit[0]);
}
}
}
string l;
registercvar(cvarname, ftos(value));
- cvar_set_normal(cvarname, ftos(value));
+ cvar_set(cvarname, ftos(value));
// note: cvarname must be remembered
fh = fopen("campaign.cfg", FILE_READ);
if(campaign_won && cheatcount_total == 0 && !autocvar__campaign_testrun)
{
- if(campaign_level == cvar_normal(campaign_index_var))
+ if(campaign_level == cvar(campaign_index_var))
{
if(campaign_entries < 2)
{
// handler for _init/_init map (only for dedicated server initialization)
world_initialized = -1; // don't complain
- cvar = cvar_normal;
- cvar_string = cvar_string_normal;
- cvar_set = cvar_set_normal;
delete_fn = remove_unsafely;
// localcmd("\nfs_rescan\n"); // FIXME: does more harm than good, has unintended side effects. What we really want is to unload temporary pk3s only
// restore csqc_progname too
string expect = "csprogs.dat";
- wantrestart = cvar_string_normal("csqc_progname") != expect;
- cvar_set_normal("csqc_progname", expect);
+ wantrestart = cvar_string("csqc_progname") != expect;
+ cvar_set("csqc_progname", expect);
}
else
{
// This always works; fall back to it if a versioned csprogs.dat is suddenly missing
string select = "csprogs.dat";
if (fexists(pk3csprogs)) select = pk3csprogs;
- if (cvar_string_normal("csqc_progname") != select)
+ if (cvar_string("csqc_progname") != select)
{
- cvar_set_normal("csqc_progname", select);
+ cvar_set("csqc_progname", select);
wantrestart = true;
}
// Check for updates on startup
string newprogs = sprintf("progs-%s.dat", switchversion);
if (fexists(newprogs))
{
- cvar_set_normal("sv_progs", newprogs);
+ cvar_set("sv_progs", newprogs);
wantrestart = true;
}
string newcsprogs = sprintf("csprogs-%s.dat", switchversion);
if (fexists(newcsprogs))
{
- cvar_set_normal("csqc_progname", newcsprogs);
+ cvar_set("csqc_progname", newcsprogs);
wantrestart = true;
}
}
}
}
- cvar = cvar_normal;
- cvar_string = cvar_string_normal;
- cvar_set = cvar_set_normal;
-
if(world_already_spawned)
error("world already spawned - you may have EXACTLY ONE worldspawn!");
world_already_spawned = true;