r_labelsprites_scale 0.40625 // labels sprites get displayed at 0.5x from 640x480 to 1280x1024, and at 1x from 1600x1200 onwards
// settemp subsystem. Do not touch. Usage: settemp variable value, next map resets it.
-set settemp_list 0
-set settemp_idx 0
-set _settemp_var UNUSED
-alias settemp "_settemp_var \"_settemp_x$settemp_idx\"; qc_cmd rpn /settemp_idx settemp_idx 1 add def; _settemp \"$1\" \"$2\""
-alias _settemp "settemp_list \"1 $1 $_settemp_var $settemp_list\"; set $_settemp_var \"${$1}\"; $1 \"$2\""
-alias settemp_restore "_settemp_restore_${settemp_list asis}"
-alias _settemp_restore_0 "set settemp_var 0; set settemp_list 0"
-alias _settemp_restore_1 "$1 \"${$2}\"; _settemp_restore_${3- asis}"
+alias settemp "cl_cmd settemp $*"
+alias settemp_restore "cl_cmd settemp_restore"
// usercommands. These can be edited and bound by the menu.
seta "userbind1_press" "say_team quad soon"; seta "userbind1_release" ""; seta "userbind1_description" "team: quad soon"
#define DP_CSQC_ENTITY_REMOVE_IS_B0RKED
-void cvar_clientsettemp(string cv, string val)
-{
- entity e;
- for(e = world; (e = find(e, classname, "saved_cvar_value")); )
- if(e.netname == cv)
- goto saved;
- e = spawn();
- e.classname = "saved_cvar_value";
- e.netname = strzone(cv);
- e.message = strzone(cvar_string(cv));
-:saved
- cvar_set(cv, val);
-}
-
-void cvar_clientsettemp_restore()
-{
- entity e;
- for(e = world; (e = find(e, classname, "saved_cvar_value")); )
- cvar_set(e.netname, e.message);
-}
-
void menu_show_error()
{
drawstring('0 200 0', _("ERROR - MENU IS VISIBLE BUT NO MENU WAS DEFINED!"), '8 8 0', '1 0 0', 1, 0);
}
// CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
-void CSQC_Shutdown(void)
+void Shutdown(void)
{
#ifdef USE_FTE
#pragma TARGET id
db_save(ClientProgsDB, "client.db");
db_close(ClientProgsDB);
- cvar_clientsettemp_restore();
-
if(camera_active)
cvar_set("chase_active",ftos(chase_active_backup));
if(argv(0) == "help" || argc == 0)
{
print(_("Usage: cl_cmd COMMAND..., where possible commands are:\n"));
- print(_(" settemp cvar value\n"));
print(_(" scoreboard_columns_set ...\n"));
print(_(" scoreboard_columns_help\n"));
GameCommand_Generic("help");
else
hud_panel_radar_maximized = (stof(argv(1)) != 0);
}
- else if(cmd == "settemp") {
- cvar_clientsettemp(argv(1), argv(2));
- }
else if(cmd == "scoreboard_columns_set") {
Cmd_HUD_SetFields(argc);
}
float hud;
float view_quality;
-
-void cvar_clientsettemp(string cv, string val);
print(" addtolist variable addedvalue\n");
print(" records\n");
print(" rankings (map argument optional)\n");
+ print(" settemp cvar value\n");
+ print(" settemp_restore\n");
return TRUE;
}
return TRUE;
#endif
}
+ else if(argv(0) == "settemp") {
+ cvar_settemp(argv(1), argv(2));
+ return TRUE;
+ }
+ else if(argv(0) == "settemp_restore") {
+ cvar_settemp_restore();
+ return TRUE;
+ }
return FALSE;
}
// MapInfo_SwitchGameType(MAPINFO_TYPE_DEATHMATCH);
//}
+ cvar_settemp_restore();
if(reinit)
- localcmd(strcat("\nsettemp_restore\nmap ", s, "\n"));
+ localcmd(strcat("\nmap ", s, "\n"));
else
- localcmd(strcat("\nsettemp_restore\nchangelevel ", s, "\n"));
+ localcmd(strcat("\nchangelevel ", s, "\n"));
}
string MapInfo_ListAllowedMaps(float pRequiredFlags, float pForbiddenFlags)
void MapInfo_Shutdown(); // call this in the shutdown handler
#define MAPINFO_SETTEMP_ACL_USER cvar_string("g_mapinfo_settemp_acl")
-#define MAPINFO_SETTEMP_ACL_SYSTEM "-g_mapinfo_* -rcon_* -settemp_* -_* -g_ban* +*"
+#define MAPINFO_SETTEMP_ACL_SYSTEM "-g_mapinfo_* -rcon_* -_* -g_ban* +*"
vector decompressShortVector(float data)
{
vector out;
- float pitch, yaw, len;
+ float p, y, len;
if(data == 0)
return '0 0 0';
- pitch = (data & 0xF000) / 0x1000;
- yaw = (data & 0x0F80) / 0x80;
- len = (data & 0x007F);
+ p = (data & 0xF000) / 0x1000;
+ y = (data & 0x0F80) / 0x80;
+ len = (data & 0x007F);
- //print("\ndecompress: pitch ", ftos(pitch)); print("yaw ", ftos(yaw)); print("len ", ftos(len), "\n");
+ //print("\ndecompress: p ", ftos(p)); print("y ", ftos(y)); print("len ", ftos(len), "\n");
- if(pitch == 0)
+ if(p == 0)
{
out_x = 0;
out_y = 0;
- if(yaw == 31)
+ if(y == 31)
out_z = -1;
else
out_z = +1;
}
else
{
- yaw = .19634954084936207740 * yaw;
- pitch = .19634954084936207740 * pitch - 1.57079632679489661922;
- out_x = cos(yaw) * cos(pitch);
- out_y = sin(yaw) * cos(pitch);
- out_z = -sin(pitch);
+ y = .19634954084936207740 * y;
+ p = .19634954084936207740 * p - 1.57079632679489661922;
+ out_x = cos(y) * cos(p);
+ out_y = sin(y) * cos(p);
+ out_z = -sin(p);
}
//print("decompressed: ", vtos(out), "\n");
float compressShortVector(vector vec)
{
vector ang;
- float pitch, yaw, len;
+ float p, y, len;
if(vlen(vec) == 0)
return 0;
//print("compress: ", vtos(vec), "\n");
error("BOGUS vectoangles");
//print("angles: ", vtos(ang), "\n");
- pitch = floor(0.5 + (ang_x + 90) * 16 / 180) & 15; // -90..90 to 0..14
- if(pitch == 0)
+ p = floor(0.5 + (ang_x + 90) * 16 / 180) & 15; // -90..90 to 0..14
+ if(p == 0)
{
if(vec_z < 0)
- yaw = 31;
+ y = 31;
else
- yaw = 30;
+ y = 30;
}
else
- yaw = floor(0.5 + ang_y * 32 / 360) & 31; // 0..360 to 0..32
+ y = floor(0.5 + ang_y * 32 / 360) & 31; // 0..360 to 0..32
len = invertLengthLog(vlen(vec));
- //print("compressed: pitch ", ftos(pitch)); print("yaw ", ftos(yaw)); print("len ", ftos(len), "\n");
+ //print("compressed: p ", ftos(p)); print("y ", ftos(y)); print("len ", ftos(len), "\n");
- return (pitch * 0x1000) + (yaw * 0x80) + len;
+ return (p * 0x1000) + (y * 0x80) + len;
}
void compressShortVector_init()
}
#endif
-#ifdef CSQC
-void cvar_settemp(string pKey, string pValue)
-{
- error("cvar_settemp called from CSQC - use cvar_clientsettemp instead!");
-}
-void cvar_settemp_restore()
+void cvar_settemp(string cv, string val)
{
- error("cvar_settemp_restore called from CSQC - use cvar_clientsettemp instead!");
-}
-#else
-void cvar_settemp(string pKey, string pValue)
-{
- float i;
- string settemp_var;
- if(cvar_string(pKey) == pValue)
- return;
- i = cvar("settemp_idx");
- cvar_set("settemp_idx", ftos(i+1));
- settemp_var = strcat("_settemp_x", ftos(i));
-#ifdef MENUQC
- registercvar(settemp_var, "", 0);
-#else
- registercvar(settemp_var, "");
-#endif
- cvar_set("settemp_list", strcat("1 ", pKey, " ", settemp_var, " ", cvar_string("settemp_list")));
- cvar_set(settemp_var, cvar_string(pKey));
- cvar_set(pKey, pValue);
+ entity e;
+ for(e = world; (e = find(e, classname, "saved_cvar_value")); )
+ if(e.netname == cv)
+ goto saved;
+ e = spawn();
+ e.classname = "saved_cvar_value";
+ e.netname = strzone(cv);
+ e.message = strzone(cvar_string(cv));
+:saved
+ cvar_set(cv, val);
}
void cvar_settemp_restore()
{
- // undo what cvar_settemp did
- float n, i;
- n = tokenize_console(cvar_string("settemp_list"));
- for(i = 0; i < n - 3; i += 3)
- cvar_set(argv(i + 1), cvar_string(argv(i + 2)));
- cvar_set("settemp_list", "0");
+ entity e;
+ while((e = find(world, classname, "saved_cvar_value")))
+ {
+ cvar_set(e.netname, e.message);
+ remove(e);
+ }
}
-#endif
float almost_equals(float a, float b)
{
return v;
}
#else
-void WriteInt24_t(float dest, float val)
+void WriteInt24_t(float dst, float val)
{
float v;
- WriteShort(dest, (v = floor(val / 256)));
- WriteByte(dest, val - v * 256); // 0..255
+ WriteShort(dst, (v = floor(val / 256)));
+ WriteByte(dst, val - v * 256); // 0..255
}
#endif
#endif
return findfloat(world, entnum, f);
}
#endif
+
+float shutdown_running;
+#ifdef SVQC
+void SV_Shutdown()
+#endif
+#ifdef CSQC
+void CSQC_Shutdown()
+#endif
+#ifdef MENUQC
+void m_shutdown()
+#endif
+{
+ if(shutdown_running)
+ {
+ print("Recursive shutdown detected! Only restoring cvars...\n");
+ }
+ else
+ {
+ shutdown_running = 1;
+ Shutdown();
+ }
+ cvar_settemp_restore(); // this must be done LAST, but in any case
+}
#endif
string fixPriorityList(string pl, float from, float to, float subtract, float complete);
+string mapPriorityList(string order, string(string) mapfunc);
string swapInPriorityList(string order, float i, float j);
float cvar_value_issafe(string s);
#define sound(e,c,s,v,a) sound7(e,c,s,v,a,0,0)
#endif
+float lowestbit(float f);
+
#ifdef CSQC
entity ReadCSQCEntity()
#endif
+
+// generic shutdown handler
+void Shutdown();
void CSQCPlayer_Remove()
{
csqcplayer = world;
- cvar_clientsettemp("cl_movement_replay", "1");
+ cvar_settemp("cl_movement_replay", "1");
}
float CSQCPlayer_PreUpdate()
return 0;
csqcplayer = self;
csqcplayer_status = CSQCPLAYERSTATUS_FROMSERVER;
- cvar_clientsettemp("cl_movement_replay", "0");
+ cvar_settemp("cl_movement_replay", "0");
self.entremove = CSQCPlayer_Remove;
return 1;
}
entity spawn(void) = #22;
void remove(entity e) = #23;
-entity findstring(entity start, .string field, string match) = #24;
+entity find(entity start, .string field, string match) = #24;
entity findfloat(entity start, .float field, float match) = #25;
entity findentity(entity start, .entity field, entity match) = #25;
}
}
-void m_shutdown()
+void Shutdown()
{
entity e;
}
else
{
- for(e = NULL; (e = findstring(e, name, itemname)); )
+ for(e = NULL; (e = find(e, name, itemname)); )
if(e.classname != "vtbl")
break;
if(e)
BADPREFIX("g_respawn_ghosts");
BADPREFIX("g_voice_flood_");
BADPREFIX("rcon_");
- BADPREFIX("settemp_");
BADPREFIX("sv_allowdownloads");
BADPREFIX("sv_autodemo");
BADPREFIX("sv_curl_");
Map_Goto_SetStr(argv(position));
}
-void GameResetCfg()
-{
- // settings persist, except...
- localcmd("\nsettemp_restore\n");
-}
-
void Map_Goto(float reinit)
{
- GameResetCfg();
MapInfo_LoadMap(getmapname_stored, reinit);
}
}
if(autocvar_lastlevel)
{
- GameResetCfg();
- localcmd("set lastlevel 0\ntogglemenu\n");
+ cvar_settemp_restore();
+ localcmd("set lastlevel 0\ntogglemenu 1\n");
alreadychangedlevel = TRUE;
return TRUE;
}
TargetMusic_RestoreGame();
}
-void SV_Shutdown()
+void Shutdown()
{
entity e;
- if(gameover > 1) // shutting down already?
- return;
-
- gameover = 2; // 2 = server shutting down
+ gameover = 2;
if(world_initialized > 0)
{
campaign.qh
../common/campaign_common.qh
../common/mapinfo.qh
-../common/util.qc
accuracy.qh
csqcprojectile.qh
../warpzonelib/util_server.qc
../warpzonelib/server.qc
+../common/util.qc
+
../common/if-this-file-errors-scroll-up-and-fix-the-warnings.fteqccfail