-Wed May 13 07:23:38 CEST 2020
+Fri May 29 07:23:43 CEST 2020
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
-# IFo Hancroft <inactive+ifohancroft@transifex.com>, 2016-2017
+# 411370735b8ef90fa32c21e58a50941e_d905c03 <7784313cf022f885419b74f26eaf98f3_541595>, 2016-2017
# set_killer <mettall@abv.bg>, 2014
# ubone <van_ds_ff@mail.bg>, 2016
# set_killer <mettall@abv.bg>, 2014
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
+# 77960155d0a4db79ed901e7c2ee242e7_4b8c532, 2016
# Hector Champipis <hector-hab@hotmail.com>, 2019
-# MasterWord, 2016
+# 77960155d0a4db79ed901e7c2ee242e7_4b8c532, 2016
# Vindex <kon14.inside@gmail.com>, 2014
# Konstantinos Mihalenas <ldinos99@gmail.com>, 2014
# Marinus Savoritias, 2018
# kammy smb <kammysmb@gmail.com>, 2013
# roader_gentoo <ivanviso123@gmail.com>, 2014
# Rodrigo Mouton Laudin <ratogenesis@gmail.com>, 2011
-# Simon <inactive+0000simon@transifex.com>, 2014-2015
+# f0318285068af6a23b2bced52c20e7ad_5b405a0 <dd7053d9f4e5c78579dd2ad9ce71aaa5_243277>, 2014-2015
# Damian Kurek <starfire24680@gmail.com>, 2018
# Damian Kurek <starfire24680@gmail.com>, 2017-2018
# Damian Kurek <starfire24680@gmail.com>, 2017
#include <common/notifications/all.qh>
#include <common/stats.qh>
+#include "hud/panel/centerprint.qh"
bool announcer_1min;
bool announcer_5min;
{
if (argv(1))
{
- centerprint_hud(argv(1));
+ centerprint_AddStandard(argv(1));
return;
}
}
HUD_Write_Cvar("hud_panel_centerprint_fade_minfontsize");
}
-// These are the functions that draw the text at the center of the screen (e.g. frag messages and server MOTDs).
-// Usually local_notification_centerprint_generic() is called, which in turn calls centerprint_generic(), which
-// uses some kind of macro magic to call HUD_CenterPrint, which draws them on screen using drawcolorcodedstring().
+// These are the functions that draw the text at the center of the screen (e.g. frag messages and server MOTD).
+// centerprint_Add parses a message and puts it in the circular buffer centerprint_messages
+// centerprint_Add is usually called by Local_Notification_centerprint_Add, which is called
+// by Local_Notification.
+// HUD_CenterPrint draws all the messages on screen
const int CENTERPRINT_MAX_MSGS = 10;
const int CENTERPRINT_MAX_ENTRIES = 50;
int cpm_index;
string centerprint_messages[CENTERPRINT_MAX_MSGS];
int centerprint_msgID[CENTERPRINT_MAX_MSGS];
+bool centerprint_bold[CENTERPRINT_MAX_MSGS];
float centerprint_time[CENTERPRINT_MAX_MSGS];
float centerprint_expire_time[CENTERPRINT_MAX_MSGS];
int centerprint_countdown_num[CENTERPRINT_MAX_MSGS];
bool centerprint_showing;
-void centerprint_generic(int new_id, string strMessage, float duration, int countdown_num)
+void centerprint_Add(int new_id, string strMessage, float duration, int countdown_num)
{
TC(int, new_id); TC(int, countdown_num);
- //printf("centerprint_generic(%d, '%s^7', %d, %d);\n", new_id, strMessage, duration, countdown_num);
+ //printf("centerprint_Add(%d, '%s^7', %d, %d);\n", new_id, strMessage, duration, countdown_num);
int i, j;
if(strMessage == "" && new_id == 0)
return;
+ // strip BOLD_OPERATOR
+ bool is_bold = (substring(strMessage, 0, 5) == BOLD_OPERATOR);
+ if (is_bold)
+ strMessage = substring(strMessage, 5, -1);
+
// strip trailing newlines
j = strlen(strMessage) - 1;
while(substring(strMessage, j, 1) == "\n" && j >= 0)
j = cpm_index;
}
strcpy(centerprint_messages[j], strMessage);
+ centerprint_bold[j] = is_bold;
centerprint_msgID[j] = new_id;
if (duration < 0)
{
void centerprint_kill(int id)
{
TC(int, id);
- centerprint_generic(id, "", 0, 0);
+ centerprint_Add(id, "", 0, 0);
}
-void centerprint_hud(string strMessage)
+void centerprint_AddStandard(string strMessage)
{
- centerprint_generic(0, strMessage, autocvar_hud_panel_centerprint_time, 0);
+ centerprint_Add(0, strMessage, autocvar_hud_panel_centerprint_time, 0);
}
-void reset_centerprint_messages()
+void centerprint_KillAll()
{
for (int i=0; i<CENTERPRINT_MAX_MSGS; ++i)
{
centerprint_expire_time[i] = 0;
centerprint_time[i] = 1;
centerprint_msgID[i] = 0;
+ centerprint_bold[i] = false;
strfree(centerprint_messages[i]);
}
}
float hud_configure_cp_generation_time;
-void HUD_CenterPrint ()
+void HUD_CenterPrint()
{
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_centerprint) return;
if(hud_configure_prev)
- reset_centerprint_messages();
+ centerprint_KillAll();
}
else
{
if(!hud_configure_prev)
{
- reset_centerprint_messages();
+ centerprint_KillAll();
hud_configure_cp_generation_time = time; // show a message immediately
}
if (time > hud_configure_cp_generation_time)
float r;
r = random();
if (r > 0.8)
- centerprint_generic(floor(r*1000), sprintf(_("^3Countdown message at time %s, seconds left: ^COUNT"), seconds_tostring(time)), 1, 10);
+ centerprint_Add(floor(r*1000), sprintf(_("^3Countdown message at time %s, seconds left: ^COUNT"), seconds_tostring(time)), 1, 10);
else if (r > 0.55)
- centerprint_generic(0, sprintf(_("^1Multiline message at time %s that\n^1lasts longer than normal"), seconds_tostring(time)), 20, 0);
+ centerprint_Add(0, sprintf(_("^1Multiline message at time %s that\n^1lasts longer than normal"), seconds_tostring(time)), 20, 0);
else
- centerprint_hud(sprintf(_("Message at time %s"), seconds_tostring(time)));
+ centerprint_AddStandard(sprintf(_("Message at time %s"), seconds_tostring(time)));
hud_configure_cp_generation_time = time + 1 + random()*4;
}
else
{
- centerprint_generic(0, _("Generic message"), 10, 0);
+ centerprint_Add(0, _("Generic message"), 10, 0);
hud_configure_cp_generation_time = time + 10 - random()*3;
}
}
panel_size -= '2 2 0' * panel_bg_padding;
}
- bool is_bold;
- string centerprint_message = strzone("");
int entries;
float height;
vector fontsize;
align = bound(0, autocvar_hud_panel_centerprint_align, 1);
for (g=0, i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
{
- // if the notification starts with ^BOLD make it bold (e.g. frag messages);
- is_bold = (substring(centerprint_messages[j], 0, 5) == BOLD_OPERATOR);
- // remove ^BOLD so it doesn't get printed onscreen
- if (is_bold)
- strcpy(centerprint_message, substring(centerprint_messages[j], 5, -1));
- else
- strcpy(centerprint_message, centerprint_messages[j]);
+ bool is_bold = centerprint_bold[j];
// entries = bound(1, floor(CENTERPRINT_MAX_ENTRIES * 4 * panel_size_y/panel_size_x), CENTERPRINT_MAX_ENTRIES);
// height = panel_size_y/entries;
all_messages_expired = false;
- // fade the centerprint_hud in/out
+ // fade
if(centerprint_time[j] < 0) // Expired but forced. Expire time is the fade-in time.
a = (time - centerprint_expire_time[j]) / max(0.0001, autocvar_hud_panel_centerprint_fade_in);
else if(centerprint_expire_time[j] - autocvar_hud_panel_centerprint_fade_out > time) // Regularily printed. Not fading out yet.
drawfontscale = hud_scale * sz;
if (centerprint_countdown_num[j])
- n = tokenizebyseparator(strreplace("^COUNT", count_seconds(centerprint_countdown_num[j]), centerprint_message), "\n");
+ n = tokenizebyseparator(strreplace("^COUNT", count_seconds(centerprint_countdown_num[j]), centerprint_messages[j]), "\n");
else
- n = tokenizebyseparator(centerprint_message, "\n");
+ n = tokenizebyseparator(centerprint_messages[j], "\n");
if (autocvar_hud_panel_centerprint_flip)
{
if (pos.y < panel_pos.y) // check if the next message can be shown
{
drawfontscale = hud_scale;
- strfree(centerprint_message);
return;
}
}
if(pos.y > panel_pos.y + panel_size.y - fontsize.y) // check if the next message can be shown
{
drawfontscale = hud_scale;
- strfree(centerprint_message);
return;
}
}
}
- strfree(centerprint_message);
drawfontscale = hud_scale;
if (all_messages_expired)
{
centerprint_showing = false;
- reset_centerprint_messages();
+ centerprint_KillAll();
}
}
#pragma once
#include "../panel.qh"
-void reset_centerprint_messages();
+void centerprint_Add(int new_id, string strMessage, float duration, int countdown_num);
+void centerprint_AddStandard(string strMessage);
+void centerprint_kill(int id);
+void centerprint_KillAll();
#include "commands/cl_cmd.qh"
#include "mapvoting.qh"
#include <client/mutators/_mod.qh>
+#include "hud/panel/centerprint.qh"
#include "hud/panel/scoreboard.qh"
#include "hud/panel/quickmenu.qh"
#include "shownames.qh"
print(ColorTranslateRGB(strMessage));
}
-// CSQC_Parse_CenterPrint : Provides the centerprint_hud string in the first parameter that the server provided.
+// CSQC_Parse_CenterPrint : Provides the centerprint_AddStandard string in the first parameter that the server provided.
void CSQC_Parse_CenterPrint(string strMessage)
{
if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_CenterPrint(\"%s\")", strMessage);
- centerprint_hud(strMessage);
+ centerprint_AddStandard(strMessage);
}
// CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
float camera_roll;
vector camera_direction;
-void centerprint_hud(string strMessage);
-void centerprint_kill(float id);
-void centerprint_generic(float new_id, string strMessage, float duration, float countdown_num);
-
const float ALPHA_MIN_VISIBLE = 0.003;
float armorblockpercent;
viewloc_mousepos.y = bound(0, viewloc_mousepos.y, vid_conheight);
//float cursor_alpha = 1 - autocvar__menu_alpha;
+ //cursor_type = CURSOR_NORMAL;
//draw_cursor(viewloc_mousepos, '0.5 0.5 0', "/cursor_move", '1 1 1', cursor_alpha);
}
if(!autocvar_hud_cursormode)
update_mousepos();
+ cursor_type = CURSOR_NORMAL;
if(autocvar__hud_configure)
HUD_Panel_Mouse();
else
const int VIEWLOC_NOSIDESCROLL = BIT(0); // NOTE: currently unimplemented
const int VIEWLOC_FREEAIM = BIT(1);
const int VIEWLOC_FREEMOVE = BIT(2);
+const int VIEWLOC_CAM_TRACK = BIT(3);
+const int VIEWLOC_CAM_NOANGLE = BIT(4);
+const int VIEWLOC_CAM_SNAP_HARD = BIT(5);
+const int VIEWLOC_CAM_SNAP_UNLOCK = BIT(6);
+const int VIEWLOC_CAM_SNAP_CLOSE = BIT(7);
.entity viewloc;
#ifdef SVQC
Kill_Notification(NOTIF_ALL, NULL, MSG_Null, CPID_Null);
#else
- reset_centerprint_messages();
+ centerprint_KillAll();
#endif
// kill all real notification entities
HUD_Notify_Push(icon, arg_slot[0], arg_slot[1]);
}
-void Local_Notification_centerprint_generic(
+void Local_Notification_centerprint_Add(
string input, string durcnt,
CPID cpid, float f1, float f2)
{
for (int sel_num = 0; (durcnt != ""); )
{
string selected = car(durcnt); durcnt = cdr(durcnt);
- NOTIF_HIT_MAX(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_generic");
+ NOTIF_HIT_MAX(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_Add");
switch (strtolower(selected))
{
#define ARG_CASE_ARG_CS_SV_HA(selected, result)
default:
{
if (/* wtf */ ftos(stof(selected)) != "") { arg_slot[sel_num++] = selected; }
- else { NOTIF_HIT_UNKNOWN(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_generic") }
+ else { NOTIF_HIT_UNKNOWN(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_Add") }
break;
}
}
}
#ifdef NOTIFICATIONS_DEBUG
Debug_Notification(sprintf(
- "Local_Notification_centerprint_generic('%s^7', '%s', %d, %d, %d, %d);\n",
+ "Local_Notification_centerprint_Add('%s^7', '%s', %d, %d, %d, %d);\n",
MakeConsoleSafe(input),
durcnt,
f1, f2,
stof(arg_slot[1])
));
#endif
- centerprint_generic(ORDINAL(cpid), input, stof(arg_slot[0]), stof(arg_slot[1]));
+ centerprint_Add(ORDINAL(cpid), input, stof(arg_slot[0]), stof(arg_slot[1]));
}
#endif
#ifdef CSQC
case MSG_CENTER:
{
- Local_Notification_centerprint_generic(
+ Local_Notification_centerprint_Add(
Local_Notification_sprintf(
notif.nent_string,
notif.nent_args,
int _net_name = net_name;
CPID net_name = ENUMCAST(CPID, _net_name);
if (net_name == CPID_Null) {
- // kill all
- reset_centerprint_messages();
+ centerprint_KillAll();
} else {
- // kill group
- centerprint_generic(ORDINAL(net_name), "", 0, 0);
+ centerprint_kill(ORDINAL(net_name));// kill group
}
return;
}
Item_SetAlpha(this);
if(this.ItemStatus & ITS_ALLOWFB)
- this.effects |= EF_FULLBRIGHT;
+ this.effects |= EF_FULLBRIGHT;
+ else
+ this.effects &= ~EF_FULLBRIGHT;
if(this.ItemStatus & ITS_GLOW)
{
if(this.ItemStatus & ITS_AVAILABLE)
this.effects |= (EF_ADDITIVE | EF_FULLBRIGHT);
else
- this.effects &= ~(EF_ADDITIVE | EF_FULLBRIGHT);
+ this.effects &= ~(EF_ADDITIVE | EF_FULLBRIGHT);
}
}
if (autocvar_g_nodepthtestitems)
e.effects |= EF_NODEPTHTEST;
-
if (autocvar_g_fullbrightitems)
e.ItemStatus |= ITS_ALLOWFB;
+ else
+ e.ItemStatus &= ~ITS_ALLOWFB;
if (autocvar_sv_simple_items)
e.ItemStatus |= ITS_ALLOWSI;
}
vector old_camera_angle = '0 0 0';
-bool autocvar_cam_snap_close;
-bool autocvar_cam_track;
-bool autocvar_cam_snap_hard;
-bool autocvar_cam_snap_unlock;
-bool autocvar_cam_useangle = true;
void viewloc_SetViewLocation()
{
entity view = CSQCModel_server2csqc(player_localentnum - 1);
if (!view) return;
- //NOTE: the "cam_" cvars sould probably be changed out with a spawnflag or an entity key. I have it like this for my testing -- Player_2
- if(view.viewloc && !wasfreed(view.viewloc) && view.viewloc.enemy && view.viewloc.goalentity)
+ entity viewloc_ent = view.viewloc;
+ if(viewloc_ent && !wasfreed(viewloc_ent) && viewloc_ent.enemy && viewloc_ent.goalentity)
{
- bool have_sidescroll = (view.viewloc.enemy != view.viewloc.goalentity);
- vector position_a = view.viewloc.enemy.origin;
- vector position_b = view.viewloc.goalentity.origin;
+ bool have_sidescroll = (viewloc_ent.enemy != viewloc_ent.goalentity);
+ vector position_a = viewloc_ent.enemy.origin;
+ vector position_b = viewloc_ent.goalentity.origin;
vector camera_angle = '0 0 0';
vector camera_position;
camera_position = vec_bounds_in(view.origin, position_a, position_b);
// use camera's angle when possible
- if (autocvar_cam_useangle) {
- camera_angle = view.viewloc.enemy.movedir;
+ if (!(viewloc_ent.spawnflags & VIEWLOC_CAM_NOANGLE)) {
+ camera_angle = viewloc_ent.enemy.movedir;
}
// a tracking camera follows the player when it leaves the world box
- if (autocvar_cam_track || !have_sidescroll) {
+ if ((viewloc_ent.spawnflags & VIEWLOC_CAM_TRACK) || !have_sidescroll) {
camera_angle = aim_vec (camera_position, view.origin);
}
// hard snap changes the angle as soon as it crosses over the nearest 90 degree mark
- if (autocvar_cam_snap_hard) {
+ if (viewloc_ent.spawnflags & VIEWLOC_CAM_SNAP_HARD) {
camera_angle = angle_snap_vec(aim_vec(camera_position, view.origin), 90);
}
// tries to avoid snapping unless it *really* needs to
- if (autocvar_cam_snap_close) {
+ if (viewloc_ent.spawnflags & VIEWLOC_CAM_SNAP_CLOSE) {
// like hard snap, but don't snap angles yet.
camera_angle = aim_vec(camera_position, view.origin);
}
//unlocking this allows the camera to look up and down. this also allows a top-down view.
- if (!autocvar_cam_snap_unlock) {
+ if (!(viewloc_ent.spawnflags & VIEWLOC_CAM_SNAP_UNLOCK)) {
camera_angle.x = 0;
camera_angle.z = 0;
}
if (have_sidescroll) {
vector view_angle = view.angles;
- if (!(view.viewloc.spawnflags & VIEWLOC_FREEAIM)) {
+ if (!(viewloc_ent.spawnflags & VIEWLOC_FREEAIM)) {
vector avatar_facing_dir;
// get the player's forward-facing direction, based on positions a and b
if (0 == input_movevalues.y) {
view_angle.y = avatar_facing_dir.y; // snap avatar to look on along the correct axis
// if (0 == input_movevalues.x) look straight ahead
- if (!(view.viewloc.spawnflags & VIEWLOC_FREEMOVE)) {
+ if (!(viewloc_ent.spawnflags & VIEWLOC_FREEMOVE)) {
if (0 > input_movevalues.x) { // look up
view_angle.x = 50;
} else if (0 < input_movevalues.x) { // look down
#pragma once
-.entity viewloc;
+// view location map object, intended for side-scrolling stages with a fixed camera position
+
+.entity viewloc; // points to the trigger_viewlocation networked entity
void viewloc_PlayerPhysics(entity this);
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)
this.sourceLoc = _sourceLoc;
if (pure) {
make_pure(this);
- #ifdef CSQC
- setorigin(this, (world.mins + world.maxs) * 0.5);
- #endif
- #ifdef SVQC
- setorigin(this, (world.mins + world.maxs) * 0.5);
- #endif
}
return this;
}
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)
{
{
case CMD_REQUEST_COMMAND:
{
- string command = builtin_cvar_string(strcat("sv_info_", argv(1)));
+ string command = cvar_string(strcat("sv_info_", argv(1)));
if (command) wordwrap_sprint(caller, command, 1000);
else print_to(caller, "ERROR: unsupported info command");
// 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;
if(MUTATOR_CALLHOOK(Scores_CountFragsRemaining))
{
- float fragsleft = FLOAT_MAX, leadingfragsleft = FLOAT_MAX;
- if (limit)
- fragsleft = limit - WinningConditionHelper_topscore;
- if (leadlimit)
- leadingfragsleft = WinningConditionHelper_secondscore + leadlimit - WinningConditionHelper_topscore;
-
- if (limit && leadlimit && autocvar_leadlimit_and_fraglimit)
- fragsleft = max(fragsleft, leadingfragsleft);
+ float fragsleft;
+ if (checkrules_suddendeathend && time >= checkrules_suddendeathend)
+ {
+ fragsleft = 1;
+ }
else
- fragsleft = min(fragsleft, leadingfragsleft);
+ {
+ fragsleft = FLOAT_MAX;
+ float leadingfragsleft = FLOAT_MAX;
+ if (limit)
+ fragsleft = limit - WinningConditionHelper_topscore;
+ if (leadlimit)
+ leadingfragsleft = WinningConditionHelper_secondscore + leadlimit - WinningConditionHelper_topscore;
+
+ if (limit && leadlimit && autocvar_leadlimit_and_fraglimit)
+ fragsleft = max(fragsleft, leadingfragsleft);
+ else
+ fragsleft = min(fragsleft, leadingfragsleft);
+ }
if (fragsleft_last != fragsleft) // do not announce same remaining frags multiple times
{
#include <common/mapinfo.qh>
#include <common/turrets/all.qh>
-#if 1
-#define cvar_string_normal builtin_cvar_string
-#define cvar_normal builtin_cvar
-#else
-string cvar_string_normal(string n)
-{
- if (!(cvar_type(n) & CVAR_TYPEFLAG_EXISTS))
- backtrace(strcat("Attempt to access undefined cvar: ", n));
- return builtin_cvar_string(n);
-}
-
-float cvar_normal(string n)
-{
- return stof(cvar_string_normal(n));
-}
-#endif
-#define cvar_set_normal builtin_cvar_set
-
.vector dropped_origin;
entity eliminatedPlayers;
#undef droptofloor
#undef sound
-#undef cvar_set
-#undef cvar_string
-#undef cvar
-var float(string name) cvar;
-var string(string name) cvar_string;
-var void(string name, string value) cvar_set;
var void delete_fn(entity e);
#undef IT_SHOTGUN
#pragma once
#define droptofloor builtin_droptofloor
-#define cvar_set builtin_cvar_set
-#define cvar_string builtin_cvar_string
-#define cvar builtin_cvar
#define IT_SHOTGUN _IT_SHOTGUN /* BIT(0) */
#define IT_SUPER_SHOTGUN _IT_SUPER_SHOTGUN /* BIT(1) */
set sv_doors_always_open 0 "If set to 1 don't close doors which after they were open"
set sv_warpzone_allow_selftarget 0 "do not touch"
+
+// don't notify cvar changes in the chat
+sv_disablenotify 1