]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/registry_API' into 'master'
authorMario <mario.mario@y7mail.com>
Fri, 29 May 2020 09:46:59 +0000 (09:46 +0000)
committerMario <mario.mario@y7mail.com>
Fri, 29 May 2020 09:46:59 +0000 (09:46 +0000)
Registry API

See merge request xonotic/xonotic-data.pk3dir!821

25 files changed:
.tx/merge-base
common.bg.po
common.el.po
common.es.po
qcsrc/client/announcer.qc
qcsrc/client/commands/cl_cmd.qc
qcsrc/client/hud/panel/centerprint.qc
qcsrc/client/hud/panel/centerprint.qh
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/client/view.qc
qcsrc/common/mapobjects/trigger/viewloc.qh
qcsrc/common/notifications/all.qc
qcsrc/common/t_items.qc
qcsrc/common/viewloc.qc
qcsrc/common/viewloc.qh
qcsrc/lib/log.qh
qcsrc/lib/oo.qh
qcsrc/server/campaign.qc
qcsrc/server/command/common.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/sys-post.qh
qcsrc/server/sys-pre.qh
xonotic-server.cfg

index 76b17ee0d96cbfc3d0e9f6020d21617e2e0f24b3..ea315e72f89d2edfb539db5cb53b31f7f3bf9b4c 100644 (file)
@@ -1 +1 @@
-Wed May 13 07:23:38 CEST 2020
+Fri May 29 07:23:43 CEST 2020
index 308bb9f6320d0977ede3c56e1b72937bc1ec5ea4..cee1af0dbe29f03fab14f2dc849108f284596999 100644 (file)
@@ -3,7 +3,7 @@
 # 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
index f7b0135c1fdb9afef381b5bd83c0abc7d6104886..a90ff281079fc2f861a6d8200ac364fd0c583885 100644 (file)
@@ -3,8 +3,9 @@
 # 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
index f303f41b510c840cffd7aaea0b23d5ec645fab74..629e7441ed900192b2a70236f81ff06d692ad97b 100644 (file)
@@ -14,7 +14,7 @@
 # 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
index 4ad25b3fd865618c2027922f6cb6b1d5f009a551..4995f5189a6196d3ea97cc7cb3a32debe1eabfa3 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <common/notifications/all.qh>
 #include <common/stats.qh>
+#include "hud/panel/centerprint.qh"
 
 bool announcer_1min;
 bool announcer_5min;
index f0c1e789ab9407037d383e651e6cfe27f0be6922..0e4dbef9a7fd81ec5c93f7196ece90ccbdc3fbe4 100644 (file)
@@ -358,7 +358,7 @@ void LocalCommand_localprint(int request, int argc)
                {
                        if (argv(1))
                        {
-                               centerprint_hud(argv(1));
+                               centerprint_AddStandard(argv(1));
                                return;
                        }
                }
index 2f5aab5ed9f49b021e57db2a9fa0ee73f23a6525..f2563c741f79ca2a8e03fe5044cc65aecdfb1c71 100644 (file)
@@ -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<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)
@@ -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<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;
@@ -272,7 +274,7 @@ void HUD_CenterPrint ()
 
                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.
@@ -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();
        }
 }
index 1bec93efa644c684b35340f4973280742b259925..92339139f0dc963af19cb488cd87c67441e67f53 100644 (file)
@@ -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();
index e51adebd02c8a2ecf08f95979f94d272775d1034..39201fd72e6a90501281cd6f46e5041e9b1c41f5 100644 (file)
@@ -11,6 +11,7 @@
 #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"
@@ -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.
index 87951ff894ba0e689101e7eb847879908a95c8e4..50fa49ae962f9576b09d00da780dd8ebb2cc19fe 100644 (file)
@@ -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;
index 3fccbb3bb3d30473a24a6eb6c27881ece04f0826..f3ffebac67e0dd2434466b15bfe711c297c1e3e9 100644 (file)
@@ -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
index 3c393afd37bd3fd03bed40ea4f75ca9b5e49b382..791c0a4904e7ef6cbf7791ebbf6784af52143231 100644 (file)
@@ -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;
 
index 663269c93558bac46a733f26d6c70a65e8921db7..371bbebee41e69f05ec092cd9a3cada76937013e 100644 (file)
@@ -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;
     }
index 7ecbd58e9c7c2481b776018524c471b85e17e089..37cb77a7a2c1d3372d2cada530968afbf663a6a3 100644 (file)
@@ -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;
index 55e37c4d9271d0c2699aeff577d8262aedf4e21f..e5f90df089ebe2498a7a1f33b68fb7012796e16e 100644 (file)
@@ -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
index 7725d2d8fd040ab506048fb91ce787e0a0cbc676..496488d179b3dfd8abd9c447bc1973493dd1a26a 100644 (file)
@@ -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);
 
index 16875c8bc3e233224cc484b49a8efa63ed5f4932..e05ad261a5dfb6f9f70c8803ab4a0875f8a027eb 100644 (file)
@@ -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)
index 70e17e6cf0b2ddc9146c3bbf52fec8d0d88f078b..a2cef664bad3b72f9936ab371b12087c1e362027 100644 (file)
@@ -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;
 }
index 110704f2bbd9b2d80cfba1f6325faa321b53f378..1a01868fb3b1cc660d0e2720dac392dfdafef648 100644 (file)
@@ -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)
                        {
index 6121867e20fd32f1e05504882ba488cbf357e91d..f791446eb5872a8b0a6fb37807d430bc9aa594d0 100644 (file)
@@ -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");
index 8d1b58629cd7374f47eb304db066e8071c36d2d0..af6b7b64d4104a175e31c016402f7093410fe22b 100644 (file)
@@ -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
                {
index cb11057eff97d8c5167600c17a97d5ccd740ba9c..35fc07beac4b5c51c81fed7ca02caeee37a33928 100644 (file)
 #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;
index 1ccf6695a185a1ad37558818e8ada3ae1205ccd6..6ccb5918caa6990f1dd999036fdc97e22beabaff 100644 (file)
@@ -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
index 9799a087ea0814e7a2d52b98f4f47a5c5d58e622..f60bb9984d408490a3e52d3dbb32656b90baa835 100644 (file)
@@ -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) */
index 664ec70020b3093c170242db862f668e4c879f6d..8a458d8d0673f5b079348949daea0e95995a86d1 100644 (file)
@@ -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