From: Mario Date: Fri, 29 May 2020 09:46:59 +0000 (+0000) Subject: Merge branch 'terencehill/registry_API' into 'master' X-Git-Tag: xonotic-v0.8.5~1010 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=9a04df193299873a8133651e4579dbfc2253b717;hp=821a95136fb3a11f2094f61f2954ea5e8966a378 Merge branch 'terencehill/registry_API' into 'master' Registry API See merge request xonotic/xonotic-data.pk3dir!821 --- diff --git a/.tx/merge-base b/.tx/merge-base index 76b17ee0d9..ea315e72f8 100644 --- a/.tx/merge-base +++ b/.tx/merge-base @@ -1 +1 @@ -Wed May 13 07:23:38 CEST 2020 +Fri May 29 07:23:43 CEST 2020 diff --git a/common.bg.po b/common.bg.po index 308bb9f632..cee1af0dbe 100644 --- a/common.bg.po +++ b/common.bg.po @@ -3,7 +3,7 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: -# IFo Hancroft , 2016-2017 +# 411370735b8ef90fa32c21e58a50941e_d905c03 <7784313cf022f885419b74f26eaf98f3_541595>, 2016-2017 # set_killer , 2014 # ubone , 2016 # set_killer , 2014 diff --git a/common.el.po b/common.el.po index f7b0135c1f..a90ff28107 100644 --- a/common.el.po +++ b/common.el.po @@ -3,8 +3,9 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: +# 77960155d0a4db79ed901e7c2ee242e7_4b8c532, 2016 # Hector Champipis , 2019 -# MasterWord, 2016 +# 77960155d0a4db79ed901e7c2ee242e7_4b8c532, 2016 # Vindex , 2014 # Konstantinos Mihalenas , 2014 # Marinus Savoritias, 2018 diff --git a/common.es.po b/common.es.po index f303f41b51..629e7441ed 100644 --- a/common.es.po +++ b/common.es.po @@ -14,7 +14,7 @@ # kammy smb , 2013 # roader_gentoo , 2014 # Rodrigo Mouton Laudin , 2011 -# Simon , 2014-2015 +# f0318285068af6a23b2bced52c20e7ad_5b405a0 , 2014-2015 # Damian Kurek , 2018 # Damian Kurek , 2017-2018 # Damian Kurek , 2017 diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index 4ad25b3fd8..4995f5189a 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -4,6 +4,7 @@ #include #include +#include "hud/panel/centerprint.qh" bool announcer_1min; bool announcer_5min; diff --git a/qcsrc/client/commands/cl_cmd.qc b/qcsrc/client/commands/cl_cmd.qc index f0c1e789ab..0e4dbef9a7 100644 --- a/qcsrc/client/commands/cl_cmd.qc +++ b/qcsrc/client/commands/cl_cmd.qc @@ -358,7 +358,7 @@ void LocalCommand_localprint(int request, int argc) { if (argv(1)) { - centerprint_hud(argv(1)); + centerprint_AddStandard(argv(1)); return; } } diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index 2f5aab5ed9..f2563c741f 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -26,9 +26,11 @@ void HUD_CenterPrint_Export(int fh) 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; @@ -36,20 +38,26 @@ const float CENTERPRINT_SPACING = 0.7; 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) @@ -99,6 +107,7 @@ void centerprint_generic(int new_id, string strMessage, float duration, int coun j = cpm_index; } strcpy(centerprint_messages[j], strMessage); + centerprint_bold[j] = is_bold; centerprint_msgID[j] = new_id; if (duration < 0) { @@ -118,40 +127,41 @@ void centerprint_generic(int new_id, string strMessage, float duration, int coun 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 hud_configure_cp_generation_time) @@ -161,16 +171,16 @@ void HUD_CenterPrint () 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; } } @@ -215,8 +225,6 @@ void HUD_CenterPrint () panel_size -= '2 2 0' * panel_bg_padding; } - bool is_bold; - string centerprint_message = strzone(""); int entries; float height; vector fontsize; @@ -233,13 +241,7 @@ void HUD_CenterPrint () align = bound(0, autocvar_hud_panel_centerprint_align, 1); for (g=0, i=0, j=cpm_index; i time) // Regularily printed. Not fading out yet. @@ -307,9 +309,9 @@ void HUD_CenterPrint () 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) { @@ -363,7 +365,6 @@ void HUD_CenterPrint () if (pos.y < panel_pos.y) // check if the next message can be shown { drawfontscale = hud_scale; - strfree(centerprint_message); return; } } @@ -376,17 +377,15 @@ void HUD_CenterPrint () 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(); } } diff --git a/qcsrc/client/hud/panel/centerprint.qh b/qcsrc/client/hud/panel/centerprint.qh index 1bec93efa6..92339139f0 100644 --- a/qcsrc/client/hud/panel/centerprint.qh +++ b/qcsrc/client/hud/panel/centerprint.qh @@ -1,4 +1,7 @@ #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(); diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index e51adebd02..39201fd72e 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -11,6 +11,7 @@ #include "commands/cl_cmd.qh" #include "mapvoting.qh" #include +#include "hud/panel/centerprint.qh" #include "hud/panel/scoreboard.qh" #include "hud/panel/quickmenu.qh" #include "shownames.qh" @@ -920,11 +921,11 @@ void CSQC_Parse_Print(string strMessage) 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. diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index 87951ff894..50fa49ae96 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -95,10 +95,6 @@ float chase_active_backup; 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; diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 3fccbb3bb3..f3ffebac67 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1635,6 +1635,7 @@ void ViewLocation_Mouse() 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); } @@ -1675,6 +1676,7 @@ void HUD_Mouse(entity player) if(!autocvar_hud_cursormode) update_mousepos(); + cursor_type = CURSOR_NORMAL; if(autocvar__hud_configure) HUD_Panel_Mouse(); else diff --git a/qcsrc/common/mapobjects/trigger/viewloc.qh b/qcsrc/common/mapobjects/trigger/viewloc.qh index 3c393afd37..791c0a4904 100644 --- a/qcsrc/common/mapobjects/trigger/viewloc.qh +++ b/qcsrc/common/mapobjects/trigger/viewloc.qh @@ -4,6 +4,11 @@ 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; diff --git a/qcsrc/common/notifications/all.qc b/qcsrc/common/notifications/all.qc index 663269c935..371bbebee4 100644 --- a/qcsrc/common/notifications/all.qc +++ b/qcsrc/common/notifications/all.qc @@ -159,7 +159,7 @@ void Destroy_All_Notifications() #ifdef SVQC Kill_Notification(NOTIF_ALL, NULL, MSG_Null, CPID_Null); #else - reset_centerprint_messages(); + centerprint_KillAll(); #endif // kill all real notification entities @@ -1130,7 +1130,7 @@ void Local_Notification_HUD_Notify_Push( 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) { @@ -1139,7 +1139,7 @@ void Local_Notification_centerprint_generic( 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) @@ -1160,14 +1160,14 @@ void Local_Notification_centerprint_generic( 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, @@ -1175,7 +1175,7 @@ void Local_Notification_centerprint_generic( 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 @@ -1289,7 +1289,7 @@ void Local_Notification(MSG net_type, Notification net_name, ...count) #ifdef CSQC case MSG_CENTER: { - Local_Notification_centerprint_generic( + Local_Notification_centerprint_Add( Local_Notification_sprintf( notif.nent_string, notif.nent_args, @@ -1408,11 +1408,9 @@ NET_HANDLE(ENT_CLIENT_NOTIFICATION, bool is_new) 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; } diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 7ecbd58e9c..37cb77a7a2 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -185,14 +185,16 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) 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); } } @@ -444,9 +446,10 @@ void Item_Show(entity e, int mode) 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; diff --git a/qcsrc/common/viewloc.qc b/qcsrc/common/viewloc.qc index 55e37c4d92..e5f90df089 100644 --- a/qcsrc/common/viewloc.qc +++ b/qcsrc/common/viewloc.qc @@ -94,21 +94,16 @@ vector CursorToWorldCoord(vector mpos) } 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; @@ -117,22 +112,22 @@ void viewloc_SetViewLocation() 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); @@ -150,7 +145,7 @@ void viewloc_SetViewLocation() } //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; } @@ -171,7 +166,7 @@ void viewloc_SetViewLocation() 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) { @@ -184,7 +179,7 @@ void viewloc_SetViewLocation() 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 diff --git a/qcsrc/common/viewloc.qh b/qcsrc/common/viewloc.qh index 7725d2d8fd..496488d179 100644 --- a/qcsrc/common/viewloc.qh +++ b/qcsrc/common/viewloc.qh @@ -1,6 +1,8 @@ #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); diff --git a/qcsrc/lib/log.qh b/qcsrc/lib/log.qh index 16875c8bc3..e05ad261a5 100644 --- a/qcsrc/lib/log.qh +++ b/qcsrc/lib/log.qh @@ -96,23 +96,17 @@ string(string, string...) strcat1n = #115; 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) diff --git a/qcsrc/lib/oo.qh b/qcsrc/lib/oo.qh index 70e17e6cf0..a2cef664ba 100644 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@ -39,12 +39,6 @@ entity __spawn(string _classname, string _sourceLoc, bool pure) 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; } diff --git a/qcsrc/server/campaign.qc b/qcsrc/server/campaign.qc index 110704f2bb..1a01868fb3 100644 --- a/qcsrc/server/campaign.qc +++ b/qcsrc/server/campaign.qc @@ -21,11 +21,6 @@ string campaign_index_var; 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) @@ -33,35 +28,6 @@ float CampaignBailout(string s) 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; @@ -113,9 +79,6 @@ void CampaignPreInit() 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) @@ -127,27 +90,13 @@ void CampaignPreInit() _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; @@ -163,9 +112,6 @@ void CampaignPostInit() 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 { @@ -173,15 +119,12 @@ void CampaignPostInit() 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]); } } } @@ -194,7 +137,7 @@ void CampaignSaveCvar(string cvarname, float value) 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); @@ -279,7 +222,7 @@ void CampaignPreIntermission() 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) { diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 6121867e20..f791446eb5 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -475,7 +475,7 @@ void CommonCommand_info(int request, entity caller, int argc) { 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"); diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 8d1b58629c..af6b7b64d4 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -568,9 +568,6 @@ spawnfunc(__init_dedicated_server) // 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; @@ -680,8 +677,8 @@ spawnfunc(worldspawn) // 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 { @@ -692,9 +689,9 @@ spawnfunc(worldspawn) // 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 @@ -713,13 +710,13 @@ spawnfunc(worldspawn) 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; } } @@ -733,10 +730,6 @@ spawnfunc(worldspawn) } } - 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; @@ -1743,16 +1736,25 @@ float WinningCondition_Scores(float limit, float leadlimit) 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 { diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index cb11057eff..35fc07beac 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -11,24 +11,6 @@ #include #include -#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; diff --git a/qcsrc/server/sys-post.qh b/qcsrc/server/sys-post.qh index 1ccf6695a1..6ccb5918ca 100644 --- a/qcsrc/server/sys-post.qh +++ b/qcsrc/server/sys-post.qh @@ -2,13 +2,7 @@ #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 diff --git a/qcsrc/server/sys-pre.qh b/qcsrc/server/sys-pre.qh index 9799a087ea..f60bb9984d 100644 --- a/qcsrc/server/sys-pre.qh +++ b/qcsrc/server/sys-pre.qh @@ -1,9 +1,6 @@ #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) */ diff --git a/xonotic-server.cfg b/xonotic-server.cfg index 664ec70020..8a458d8d06 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -579,3 +579,6 @@ set sv_showfps 5 "Show player's FPS counters in the scoreboard. This setting act 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