Merge remote-tracking branch 'origin/master' into terencehill/ca_arena_mutators
authorSamual Lenks <samual@xonotic.org>
Tue, 7 May 2013 05:13:01 +0000 (01:13 -0400)
committerSamual Lenks <samual@xonotic.org>
Tue, 7 May 2013 05:13:01 +0000 (01:13 -0400)
37 files changed:
_hud_common.cfg
defaultXonotic.cfg
notifications.cfg
qcsrc/Makefile
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/client/autocvars.qh
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/hud_config.qc
qcsrc/common/constants.qh
qcsrc/common/notifications.qc
qcsrc/common/notifications.qh
qcsrc/common/teams.qh
qcsrc/common/util.qh
qcsrc/menu/classes.c
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.c
qcsrc/menu/xonotic/radiobutton.c
qcsrc/menu/xonotic/weaponarenacheckbox.c [new file with mode: 0644]
qcsrc/server/autocvars.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/command/vote.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/gamemode_domination.qc
qcsrc/server/mutators/mutator_touchexplode.qc [new file with mode: 0644]
qcsrc/server/mutators/mutators.qh
qcsrc/server/progs.src
qcsrc/server/tturrets/units/unit_machinegun.qc
qcsrc/server/vehicles/vehicles.qc
qcsrc/server/w_hagar.qc
tooltips.db
tooltips.db.it
unit_fusreac.cfg

index ca90bc9..15453b7 100644 (file)
@@ -44,6 +44,8 @@ alias -hud_panel_radar_maximized "cl_cmd hud radar 0"
 alias hud_panel_radar_maximized "cl_cmd hud radar"
 
 // other hud cvars
+seta hud_panel_update_interval 2 "how often (in seconds) common panel cvars are reloaded"
+
 seta hud_showbinds 1   "what to show in the HUD to indicate certain keys to press: 0 display commands, 1 bound keys, 2 both"
 seta hud_showbinds_limit 2     "maximum number of bound keys to show for a command. 0 for unlimited"
 set _hud_showbinds_reload 0    "set it to 1 to reload binds if you changed any. It is reset to 0 automatically"
index 2af290f..de83c9a 100644 (file)
@@ -900,7 +900,7 @@ seta "userbind8_press" "say_team flag seen (l:%y^7); g_waypointsprite_team_here_
 seta "userbind9_press" "say_team defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here";  seta "userbind9_release" "";  seta "userbind9_description" "team: defending, icon"
 seta "userbind10_press" "say_team roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here";  seta "userbind10_release" "";  seta "userbind10_description" "team: roaming, icon"
 seta "userbind11_press" "say_team attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here";  seta "userbind11_release" "";  seta "userbind11_description" "team: attacking, icon"
-seta "userbind12_press" "say_team killed flagcarrier (l:%y^7); g_waypointsprite_team_p"; seta "userbind12_release" ""; seta "userbind12_description" "team: killed flag, icon"
+seta "userbind12_press" "say_team killed flagcarrier (l:%y^7); g_waypointsprite_team_here_p"; seta "userbind12_release" ""; seta "userbind12_description" "team: killed flag, icon"
 seta "userbind13_press" "say_team dropped flag (l:%d^7); g_waypointsprite_team_here_d"; seta "userbind13_release" ""; seta "userbind13_description" "team: dropped flag, icon"
 seta "userbind14_press" "say_team dropped gun %w^7 (l:%l^7); g_waypointsprite_team_here; wait; dropweapon"; seta "userbind14_release" ""; seta "userbind14_description" "team: drop gun, icon"
 // TODO change this to "use" once we can
@@ -989,8 +989,7 @@ seta menu_slist_showfull 1 "show servers even if they are full and have no slots
 seta menu_slist_showempty 1 "show servers even if they are no empty and have no opponents to play against"
 seta menu_slist_modfilter "" // set to either: !modname or modname. modname of = means "same as we are running now".
 
-// for menu weapon arena
-set menu_weaponarena_with_laser 0 "also enable the Laser in this weapon arena"
+seta menu_weaponarena ""
 
 seta menu_maxplayers 16 "maxplayers value when the menu starts a game"
 
index c45b04e..1463d19 100644 (file)
@@ -523,6 +523,7 @@ seta notification_allow_chatboxprint "1" "Allow notifications to be printed to c
 seta notification_ctf_capture_verbose "0" "Show extra information when someone captures a flag"
 seta notification_ctf_pickup_enemy_verbose "0" "Show extra information if an enemy picks up a flag"
 seta notification_ctf_pickup_team_verbose "0" "Show extra information if a team mate picks up a flag"
+seta notification_debug "0" "Print extra debug information on all notification function calls (Requires -DNOTIFICATIONS_DEBUG flag to be enabled on QCSRC compilation)... 0 = disabled, 1 = dprint, 2 = print"
 seta notification_errors_are_fatal "1" "If a notification fails upon initialization, cause a Host_Error to stop the program"
 seta notification_frag_verbose "1" "Show extra information when you frag someone (or when you are fragged"
 seta notification_item_centerprinttime "1.5" "How long to show item information centerprint messages (like 'You got the Electro' or such)"
index 3e98265..4f77258 100644 (file)
@@ -34,6 +34,7 @@ QCCFLAGS ?= \
        -funtyped-nil \
        -fno-permissive \
        -fvariadic-args \
+       -DNOTIFICATIONS_DEBUG \
        $(QCCFLAGS_EXTRA) $(QCCFLAGS_WATERMARK)
 else
 # this. is. fteqccccccccccccccccccc!
index ecc2000..7a11300 100644 (file)
@@ -156,7 +156,8 @@ void CSQC_Init(void)
        CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
        CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
        CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
-       
+       CALL_ACCUMULATED_FUNCTION(RegisterHUD_Panels);
+
        WaypointSprite_Load();
 
        // precaches
@@ -210,7 +211,6 @@ void CSQC_Init(void)
 
        hud_skin_path = strzone(strcat("gfx/hud/", autocvar_hud_skin));
        hud_configure_prev = -1;
-       tab_panel = -1;
 
        draw_currentSkin = strzone(strcat("gfx/menu/", cvar_string("menu_skin")));
 }
index 90905bd..d27fd4d 100644 (file)
@@ -384,6 +384,7 @@ float checkfail[16];
 #define BUTTON_3 4
 #define BUTTON_4 8
 float cl_notice_run();
+float prev_myteam;
 void CSQC_UpdateView(float w, float h)
 {
        entity e;
@@ -442,6 +443,14 @@ void CSQC_UpdateView(float w, float h)
 #endif
                myteam = GetPlayerColor(player_localentnum - 1);
 
+       if(myteam != prev_myteam)
+       {
+               myteamcolors = colormapPaletteColor(myteam, 1);
+               for(i = 0; i < HUD_PANEL_NUM; ++i)
+                       hud_panel[i].update_time = time;
+               prev_myteam = myteam;
+       }
+
        ticrate = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
 
        float is_dead = (getstati(STAT_HEALTH) <= 0);
index 2ceb5fb..c13e2bf 100644 (file)
@@ -304,6 +304,7 @@ float autocvar_hud_panel_score;
 float autocvar_hud_panel_score_rankings;
 float autocvar_hud_panel_timer;
 float autocvar_hud_panel_timer_increment;
+float autocvar_hud_panel_update_interval;
 float autocvar_hud_panel_vote;
 float autocvar_hud_panel_vote_alreadyvoted_alpha;
 string autocvar_hud_panel_vote_bg_alpha;
index a9f8410..109b83d 100644 (file)
@@ -313,6 +313,10 @@ void CSQCPlayer_FallbackFrame_PostUpdate(float isnew)
        }
        self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame);
 }
+void CSQCPlayer_AnimDecide_PostUpdate(float isnew)
+{
+       self.csqcmodel_isdead = !!(self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
+}
 float CSQCPlayer_FallbackFrame(float f)
 {
        if(frameduration(self.modelindex, f) > 0)
@@ -692,7 +696,9 @@ void CSQCModel_Hook_PostUpdate(float isnew, float isplayer, float islocalplayer)
        if(self.isplayermodel)
        {
                CSQCPlayer_ForceModel_PostUpdate();
-               if(!isplayer)
+               if(isplayer)
+                       CSQCPlayer_AnimDecide_PostUpdate(isnew);
+               else
                        CSQCPlayer_FallbackFrame_PostUpdate(isnew);
        }
        CSQCModel_Effects_PostUpdate();
index 7d44d77..ee44db9 100644 (file)
@@ -487,11 +487,9 @@ void HUD_Weapons(void)
                        return;
                }
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_WEAPONS;
 
        // update generic hud functions
-       HUD_Panel_UpdateCvars(weapons);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
 
        draw_beginBoldFont();
@@ -950,10 +948,8 @@ void HUD_Ammo(void)
                if(!autocvar_hud_panel_ammo) return;
                if(spectatee_status == -1) return;
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_AMMO;
 
-       HUD_Panel_UpdateCvars(ammo);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
 
        draw_beginBoldFont();
@@ -1154,14 +1150,12 @@ void HUD_Powerups(void)
        }
        else
        {
-               hud_configure_active_panel = HUD_PANEL_POWERUPS;
-
                strength_time = 15;
                shield_time = 27;
                superweapons_time = 13;
        }
 
-       HUD_Panel_UpdateCvars(powerups);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
 
        draw_beginBoldFont();
@@ -1397,14 +1391,12 @@ void HUD_HealthArmor(void)
        }
        else
        {
-               hud_configure_active_panel = HUD_PANEL_HEALTHARMOR;
-
                health = 150;
                armor = 75;
                fuel = 20;
        }
 
-       HUD_Panel_UpdateCvars(healtharmor);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
        vector pos, mySize;
        pos = panel_pos;
@@ -1656,10 +1648,8 @@ void HUD_Notify(void)
        {
                if(!autocvar_hud_panel_notify) return;
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_NOTIFY;
 
-       HUD_Panel_UpdateCvars(notify);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
        vector pos, mySize;
        pos = panel_pos;
@@ -1795,10 +1785,8 @@ void HUD_Timer(void)
        {
                if(!autocvar_hud_panel_timer) return;
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_TIMER;
 
-       HUD_Panel_UpdateCvars(timer);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
 
        draw_beginBoldFont();
@@ -1865,12 +1853,10 @@ void HUD_Radar(void)
                        if (autocvar_hud_panel_radar != 2 && !teamplay) return;
                }
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_RADAR;
 
-       HUD_Panel_UpdateCvars(radar);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
-       
+
        float f = 0;
 
        if (hud_panel_radar_maximized && !autocvar__hud_configure)
@@ -2159,10 +2145,8 @@ void HUD_Score(void)
                if(!autocvar_hud_panel_score) return;
                if(spectatee_status == -1 && (gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_SCORE;
 
-       HUD_Panel_UpdateCvars(score);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
        vector pos, mySize;
        pos = panel_pos;
@@ -2356,10 +2340,8 @@ void HUD_RaceTimer (void)
                if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
                if(spectatee_status == -1) return;
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_RACETIMER;
 
-       HUD_Panel_UpdateCvars(racetimer);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
 
        draw_beginBoldFont();
@@ -2508,7 +2490,7 @@ float vote_prev; // previous state of vote_active to check for a change
 float vote_alpha;
 float vote_change; // "time" when vote_active changed
 
-void HUD_VoteWindow(void) 
+void HUD_Vote(void)
 {
        if(autocvar_cl_allow_uid2name == -1 && (gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE || (serverflags & SERVERFLAG_PLAYERSTATS)))
        {
@@ -2540,8 +2522,6 @@ void HUD_VoteWindow(void)
        }
        else
        {
-               hud_configure_active_panel = HUD_PANEL_VOTE;
-
                vote_yescount = 3;
                vote_nocount = 2;
                vote_needed = 4;
@@ -2562,7 +2542,7 @@ void HUD_VoteWindow(void)
        if(!vote_alpha)
                return;
 
-       HUD_Panel_UpdateCvars(vote);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
 
        if(uid2name_dialog)
@@ -3388,10 +3368,8 @@ void HUD_ModIcons(void)
                if(!autocvar_hud_panel_modicons) return;
                if (gametype != MAPINFO_TYPE_CTF && gametype != MAPINFO_TYPE_KEYHUNT && gametype != MAPINFO_TYPE_NEXBALL && gametype != MAPINFO_TYPE_CTS && gametype != MAPINFO_TYPE_RACE && gametype != MAPINFO_TYPE_CA && gametype != MAPINFO_TYPE_FREEZETAG && gametype != MAPINFO_TYPE_KEEPAWAY && gametype != MAPINFO_TYPE_DOMINATION) return;
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_MODICONS;
 
-       HUD_Panel_UpdateCvars(modicons);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
 
        draw_beginBoldFont();
@@ -3440,18 +3418,15 @@ void HUD_ModIcons(void)
 
 // Draw pressed keys (#11)
 //
-void HUD_DrawPressedKeys(void)
+void HUD_PressedKeys(void)
 {
        if(!autocvar__hud_configure)
        {
                if(!autocvar_hud_panel_pressedkeys) return;
                if(spectatee_status <= 0 && autocvar_hud_panel_pressedkeys < 2) return;
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_PRESSEDKEYS;
 
-
-       HUD_Panel_UpdateCvars(pressedkeys);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
        vector pos, mySize;
        pos = panel_pos;
@@ -3522,10 +3497,8 @@ void HUD_Chat(void)
                if(autocvar__con_chat_maximized)
                        if(!hud_draw_maximized) return;
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_CHAT;
 
-       HUD_Panel_UpdateCvars(chat);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
 
        if(autocvar__con_chat_maximized && !autocvar__hud_configure) // draw at full screen height if maximized
@@ -3598,10 +3571,8 @@ void HUD_EngineInfo(void)
        {
                if(!autocvar_hud_panel_engineinfo) return;
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_ENGINEINFO;
 
-       HUD_Panel_UpdateCvars(engineinfo);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
        vector pos, mySize;
        pos = panel_pos;
@@ -3661,10 +3632,8 @@ void HUD_InfoMessages(void)
        {
                if(!autocvar_hud_panel_infomessages) return;
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_INFOMESSAGES;
 
-       HUD_Panel_UpdateCvars(infomessages);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
        vector pos, mySize;
        pos = panel_pos;
@@ -3852,10 +3821,8 @@ void HUD_Physics(void)
                if(spectatee_status == -1 && (autocvar_hud_panel_physics == 1 || autocvar_hud_panel_physics == 3)) return;
                if(autocvar_hud_panel_physics == 3 && !(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
        }
-       else
-               hud_configure_active_panel = HUD_PANEL_PHYSICS;
 
-       HUD_Panel_UpdateCvars(physics);
+       HUD_Panel_UpdateCvars();
        HUD_Panel_ApplyFadeAlpha();
 
        draw_beginBoldFont();
@@ -4235,8 +4202,6 @@ void HUD_CenterPrint (void)
        }
        else
        {
-               hud_configure_active_panel = HUD_PANEL_CENTERPRINT;
-
                if (!hud_configure_prev)
                        reset_centerprint_messages();
                if (time > hud_configure_cp_generation_time)
@@ -4253,7 +4218,7 @@ void HUD_CenterPrint (void)
                }
        }
 
-       HUD_Panel_UpdateCvars(centerprint);
+       HUD_Panel_UpdateCvars();
 
        // this panel doesn't fade when showing the scoreboard
        if(autocvar__menu_alpha)
@@ -4441,44 +4406,6 @@ void HUD_Reset (void)
                HUD_Mod_CTF_Reset();
 }
 
-#define HUD_DrawPanel(id)\
-switch (id) {\
-       case (HUD_PANEL_RADAR):\
-               HUD_Radar(); break;\
-       case (HUD_PANEL_WEAPONS):\
-               HUD_Weapons(); break;\
-       case (HUD_PANEL_AMMO):\
-               HUD_Ammo(); break;\
-       case (HUD_PANEL_POWERUPS):\
-               HUD_Powerups(); break;\
-       case (HUD_PANEL_HEALTHARMOR):\
-               HUD_HealthArmor(); break;\
-       case (HUD_PANEL_NOTIFY):\
-               HUD_Notify(); break;\
-       case (HUD_PANEL_TIMER):\
-               HUD_Timer(); break;\
-       case (HUD_PANEL_SCORE):\
-               HUD_Score(); break;\
-       case (HUD_PANEL_RACETIMER):\
-               HUD_RaceTimer(); break;\
-       case (HUD_PANEL_VOTE):\
-               HUD_VoteWindow(); break;\
-       case (HUD_PANEL_MODICONS):\
-               HUD_ModIcons(); break;\
-       case (HUD_PANEL_PRESSEDKEYS):\
-               HUD_DrawPressedKeys(); break;\
-       case (HUD_PANEL_CHAT):\
-               HUD_Chat(); break;\
-       case (HUD_PANEL_ENGINEINFO):\
-               HUD_EngineInfo(); break;\
-       case (HUD_PANEL_INFOMESSAGES):\
-               HUD_InfoMessages(); break;\
-       case (HUD_PANEL_PHYSICS):\
-               HUD_Physics(); break;\
-       case (HUD_PANEL_CENTERPRINT):\
-               HUD_CenterPrint(); break;\
-} ENDS_WITH_CURLY_BRACE
-
 void HUD_Main (void)
 {
        float i;
@@ -4508,7 +4435,7 @@ void HUD_Main (void)
        // they must call HUD_Panel_ApplyFadeAlpha(); only when showing the menu
        if(scoreboard_fade_alpha == 1)
        {
-               HUD_CenterPrint();
+               (panel = HUD_PANEL(CENTERPRINT)).panel_draw();
                return;
        }
 
@@ -4557,7 +4484,10 @@ void HUD_Main (void)
                vector color;
                float hud_dock_color_team = autocvar_hud_dock_color_team;
                if((teamplay) && hud_dock_color_team) {
-                       color = colormapPaletteColor(myteam, 1) * hud_dock_color_team;
+                       if(autocvar__hud_configure && myteam == NUM_SPECTATOR)
+                               color = '1 0 0' * hud_dock_color_team;
+                       else
+                               color = myteamcolors * hud_dock_color_team;
                }
                else if(autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && hud_dock_color_team) {
                        color = '1 0 0' * hud_dock_color_team;
@@ -4632,31 +4562,35 @@ void HUD_Main (void)
        hud_draw_maximized = 0;
        // draw panels in order specified by panel_order array
        for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
-               HUD_DrawPanel(panel_order[i]);
+               (panel = hud_panel[panel_order[i]]).panel_draw();
 
        hud_draw_maximized = 1; // panels that may be maximized must check this var
        // draw maximized panels on top
        if(hud_panel_radar_maximized)
-               HUD_Radar();
+               (panel = HUD_PANEL(RADAR)).panel_draw();
        if(autocvar__con_chat_maximized)
-               HUD_Chat();
+               (panel = HUD_PANEL(CHAT)).panel_draw();
 
        if(autocvar__hud_configure)
        {
-               if(tab_panel != -1)
+               if(tab_panel)
                {
-                       HUD_Panel_UpdatePosSizeForId(tab_panel)
+                       panel = tab_panel;
+                       HUD_Panel_UpdatePosSize()
                        drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
                }
-               if(highlightedPanel != -1)
+               if(highlightedPanel)
                {
-                       HUD_Panel_UpdatePosSizeForId(highlightedPanel);
+                       panel = highlightedPanel;
+                       HUD_Panel_UpdatePosSize()
                        HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha));
                }
                if(!hud_configure_prev || hud_configure_prev == -1)
                {
                        if(autocvar_hud_cursormode) { setcursormode(1); }
                        hudShiftState = 0;
+                       for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
+                               hud_panel[panel_order[i]].update_time = time;
                }
        }
        else if (hud_configure_prev && autocvar_hud_cursormode)
index bef2079..19cd36d 100644 (file)
@@ -1,4 +1,10 @@
-float panel_order[HUD_PANEL_NUM];
+#define HUD_PANEL_MAX 24
+entity hud_panel[HUD_PANEL_MAX];
+#define HUD_PANEL_FIRST 0
+float HUD_PANEL_NUM;
+float HUD_PANEL_LAST;
+
+float panel_order[HUD_PANEL_MAX];
 string hud_panelorder_prev;
 
 float hud_draw_maximized;
@@ -8,7 +14,7 @@ vector mousepos;
 vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click)
 vector panel_click_resizeorigin; // coordinates for opposite point when resizing
 float resizeCorner; // 1 = topleft, 2 = topright, 3 = bottomleft, 4 = bottomright
-var float highlightedPanel = -1;
+entity highlightedPanel;
 float highlightedAction; // 0 = nothing, 1 = move, 2 = resize
 
 const float BORDER_MULTIPLIER = 0.25;
@@ -48,17 +54,29 @@ float hud_fade_alpha;
 string hud_skin_path;
 string hud_skin_prev;
 
+vector myteamcolors;
+
 var vector progressbar_color;
 
-var float highlightedPanel_backup = -1;
+entity highlightedPanel_backup;
 var vector panel_pos_backup;
 var vector panel_size_backup;
 
-var float highlightedPanel_copied = -1; //this is good only to know if there is something copied
 var vector panel_size_copied;
 
-var float hud_configure_active_panel; // this panel has recently referred the UpdateCvars macro
-var string panel_name;
+entity panel;
+.string panel_name;
+.float panel_id;
+.vector current_panel_pos;
+.vector current_panel_size;
+.string current_panel_bg;
+.float current_panel_bg_alpha;
+.float current_panel_bg_border;
+.vector current_panel_bg_color;
+.float current_panel_bg_color_team;
+.float current_panel_bg_padding;
+.float current_panel_fg_alpha;
+.float update_time;
 var float panel_enabled;
 var vector panel_pos;
 var vector panel_size;
@@ -76,8 +94,52 @@ var string panel_bg_border_str;
 var float panel_bg_padding;
 var string panel_bg_padding_str;
 
+.void() panel_draw;
+
 float current_player;
 
+
+#define HUD_PANELS \
+       HUD_PANEL(WEAPONS      , HUD_Weapons      , weapons) \
+       HUD_PANEL(AMMO         , HUD_Ammo         , ammo) \
+       HUD_PANEL(POWERUPS     , HUD_Powerups     , powerups) \
+       HUD_PANEL(HEALTHARMOR  , HUD_HealthArmor  , healtharmor) \
+       HUD_PANEL(NOTIFY       , HUD_Notify       , notify) \
+       HUD_PANEL(TIMER        , HUD_Timer        , timer) \
+       HUD_PANEL(RADAR        , HUD_Radar        , radar) \
+       HUD_PANEL(SCORE        , HUD_Score        , score) \
+       HUD_PANEL(RACETIMER    , HUD_RaceTimer    , racetimer) \
+       HUD_PANEL(VOTE         , HUD_Vote         , vote) \
+       HUD_PANEL(MODICONS     , HUD_ModIcons     , modicons) \
+       HUD_PANEL(PRESSEDKEYS  , HUD_PressedKeys  , pressedkeys) \
+       HUD_PANEL(CHAT         , HUD_Chat         , chat) \
+       HUD_PANEL(ENGINEINFO   , HUD_EngineInfo   , engineinfo) \
+       HUD_PANEL(INFOMESSAGES , HUD_InfoMessages , infomessages) \
+       HUD_PANEL(PHYSICS      , HUD_Physics      , physics) \
+       HUD_PANEL(CENTERPRINT  , HUD_CenterPrint  , centerprint)
+
+#define HUD_PANEL(NAME,draw_func,name) \
+       float HUD_PANEL_##NAME; \
+       void ##draw_func(void); \
+       void RegisterHUD_Panel_##NAME() \
+       { \
+               HUD_PANEL_LAST = HUD_PANEL_##NAME = HUD_PANEL_NUM; \
+               entity hud_panelent = spawn(); \
+               hud_panel[HUD_PANEL_##NAME] = hud_panelent; \
+               hud_panelent.classname = "hud_panel"; \
+               hud_panelent.panel_name = #name; \
+               hud_panelent.panel_id = HUD_PANEL_##NAME; \
+               hud_panelent.panel_draw = ##draw_func; \
+               ++HUD_PANEL_NUM; \
+       } \
+       ACCUMULATE_FUNCTION(RegisterHUD_Panels, RegisterHUD_Panel_##NAME)
+
+HUD_PANELS
+#undef HUD_PANEL
+
+#define HUD_PANEL(NAME) hud_panel[HUD_PANEL_##NAME]
+
+
 // Because calling lots of functions in QC apparently cuts fps in half on many machines:
 // ----------------------
 // MACRO HELL STARTS HERE
@@ -126,7 +188,10 @@ if(!autocvar__hud_configure && panel_bg_str == "0") {\
 // Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.
 #define HUD_Panel_GetColor()\
 if((teamplay) && panel_bg_color_team) {\
-       panel_bg_color = colormapPaletteColor(myteam, 1) * panel_bg_color_team;\
+       if(autocvar__hud_configure && myteam == NUM_SPECTATOR)\
+               panel_bg_color = '1 0 0' * panel_bg_color_team;\
+       else\
+               panel_bg_color = myteamcolors * panel_bg_color_team;\
 } else if (autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && panel_bg_color_team) {\
        panel_bg_color = '1 0 0' * panel_bg_color_team;\
 } else {\
@@ -153,7 +218,7 @@ if(panel_bg_color_team_str == "") {\
 
 // the check doesn't allow to fade this panel when showing the panel-specific menu dialog
 #define HUD_Panel_ApplyFadeAlpha()\
-if(!(menu_enabled == 2 && highlightedPanel == hud_configure_active_panel))\
+if(!(menu_enabled == 2 && panel == highlightedPanel))\
 {\
        panel_bg_alpha *= hud_fade_alpha;\
        panel_fg_alpha *= hud_fade_alpha;\
@@ -169,7 +234,7 @@ panel_bg_alpha = stof(panel_bg_alpha_str);\
 if(autocvar__hud_configure) {\
        if(!panel_enabled)\
                panel_bg_alpha = 0.25;\
-       else if(menu_enabled == 2 && highlightedPanel == hud_configure_active_panel)\
+       else if(menu_enabled == 2 && panel == highlightedPanel)\
                panel_bg_alpha = (1 - autocvar__menu_alpha) * max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha) + autocvar__menu_alpha * panel_bg_alpha;\
        else\
                panel_bg_alpha = max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha);\
@@ -256,90 +321,60 @@ else\
        }\
 }
 
-// Update all common cvars of given panel name
-#define HUD_Panel_UpdateCvars(name) \
-panel_enabled = autocvar_hud_panel_##name; \
-panel_pos = stov(cvar_string("hud_panel_" #name "_pos")); \
-panel_size = stov(cvar_string("hud_panel_" #name "_size")); \
-panel_bg_str = cvar_string("hud_panel_" #name "_bg"); \
-panel_bg_color_str = cvar_string("hud_panel_" #name "_bg_color"); \
-panel_bg_color_team_str = cvar_string("hud_panel_" #name "_bg_color_team"); \
-panel_bg_alpha_str = cvar_string("hud_panel_" #name "_bg_alpha"); \
-panel_bg_border_str = cvar_string("hud_panel_" #name "_bg_border"); \
-panel_bg_padding_str = cvar_string("hud_panel_" #name "_bg_padding"); \
-HUD_Panel_GetStringVars()\
-if(menu_enabled == 2 && hud_configure_active_panel == highlightedPanel) {\
-       HUD_Panel_GetMenuSize()\
-       HUD_Panel_GetMenuPos()\
+// NOTE: in hud_configure mode cvars must be reloaded every frame
+#define HUD_Panel_UpdateCvars() \
+if(panel.update_time <= time) { \
+       if(autocvar__hud_configure) panel_enabled = cvar(strcat("hud_panel_", panel.panel_name)); \
+       panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \
+       panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size"))); \
+       panel_bg_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg")); \
+       panel_bg_color_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color")); \
+       panel_bg_color_team_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color_team")); \
+       panel_bg_alpha_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_alpha")); \
+       panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \
+       panel_bg_padding_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_padding")); \
+       HUD_Panel_GetStringVars()\
+       if(menu_enabled == 2 && panel == highlightedPanel) {\
+               HUD_Panel_GetMenuSize()\
+               HUD_Panel_GetMenuPos()\
+       } \
+       panel.current_panel_pos = panel_pos; \
+       panel.current_panel_size = panel_size; \
+       if(panel.current_panel_bg != "") \
+               strunzone(panel.current_panel_bg); \
+       panel.current_panel_bg = strzone(panel_bg); \
+       panel.current_panel_bg_alpha = panel_bg_alpha; \
+       panel.current_panel_bg_border = panel_bg_border; \
+       panel.current_panel_bg_color = panel_bg_color; \
+       panel.current_panel_bg_color_team = panel_bg_color_team; \
+       panel.current_panel_bg_padding = panel_bg_padding; \
+       panel.current_panel_fg_alpha = panel_fg_alpha; \
+       panel.update_time = (autocvar__hud_configure) ? time : time + autocvar_hud_panel_update_interval; \
+} else { \
+       panel_pos = panel.current_panel_pos; \
+       panel_size = panel.current_panel_size; \
+       panel_bg = panel.current_panel_bg; \
+       panel_bg_alpha = panel.current_panel_bg_alpha; \
+       panel_bg_border = panel.current_panel_bg_border; \
+       panel_bg_color = panel.current_panel_bg_color; \
+       panel_bg_color_team = panel.current_panel_bg_color_team; \
+       panel_bg_padding = panel.current_panel_bg_padding; \
+       panel_fg_alpha = panel.current_panel_fg_alpha; \
 } ENDS_WITH_CURLY_BRACE
 
-// FTEQCC I HATE YOU WHY DO YOU MAKE ME DO THIS??? :(
-// max macro length is 1024 characters, I must split it up :(
-
-// Update all common cvars of given panel id
-#define HUD_Panel_UpdateCvarsForId_Part2(id) \
-switch(id) { \
-       case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdateCvars(infomessages) break; \
-       case HUD_PANEL_PHYSICS: HUD_Panel_UpdateCvars(physics); break;\
-       case HUD_PANEL_CENTERPRINT: HUD_Panel_UpdateCvars(centerprint); break;\
-}
-
-#define HUD_Panel_UpdateCvarsForId(id) \
-switch(id) { \
-       case HUD_PANEL_WEAPONS: HUD_Panel_UpdateCvars(weapons) break; \
-       case HUD_PANEL_AMMO: HUD_Panel_UpdateCvars(ammo) break; \
-       case HUD_PANEL_POWERUPS: HUD_Panel_UpdateCvars(powerups) break; \
-       case HUD_PANEL_HEALTHARMOR: HUD_Panel_UpdateCvars(healtharmor) break; \
-       case HUD_PANEL_NOTIFY: HUD_Panel_UpdateCvars(notify) break; \
-       case HUD_PANEL_TIMER: HUD_Panel_UpdateCvars(timer) break; \
-       case HUD_PANEL_RADAR: HUD_Panel_UpdateCvars(radar) break; \
-       case HUD_PANEL_SCORE: HUD_Panel_UpdateCvars(score) break; \
-       case HUD_PANEL_RACETIMER: HUD_Panel_UpdateCvars(racetimer) break; \
-       case HUD_PANEL_VOTE: HUD_Panel_UpdateCvars(vote) break; \
-       case HUD_PANEL_MODICONS: HUD_Panel_UpdateCvars(modicons) break; \
-       case HUD_PANEL_PRESSEDKEYS: HUD_Panel_UpdateCvars(pressedkeys) break; \
-       case HUD_PANEL_CHAT: HUD_Panel_UpdateCvars(chat) break; \
-       case HUD_PANEL_ENGINEINFO: HUD_Panel_UpdateCvars(engineinfo) break; \
-       default: HUD_Panel_UpdateCvarsForId_Part2(id)\
-}
-
-#define HUD_Panel_UpdatePosSize(name) \
-panel_pos = stov(cvar_string("hud_panel_" #name "_pos")); \
-panel_size = stov(cvar_string("hud_panel_" #name "_size")); \
+#define HUD_Panel_UpdatePosSize() {\
+panel_enabled = cvar(strcat("hud_panel_", panel.panel_name)); \
+panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \
+panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size"))); \
 HUD_Panel_GetScaledVectors()\
-if(menu_enabled == 2 && hud_configure_active_panel == highlightedPanel) {\
+if(menu_enabled == 2 && panel == highlightedPanel) {\
        HUD_Panel_GetMenuSize()\
        HUD_Panel_GetMenuPos()\
 }\
-panel_bg_border_str = cvar_string("hud_panel_" #name "_bg_border"); \
-HUD_Panel_GetBorder()
-
-// Update pos and size of given panel id
-#define HUD_Panel_UpdatePosSizeForId_Part2(id) \
-switch(id) { \
-       case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdatePosSize(infomessages) break;\
-       case HUD_PANEL_PHYSICS: HUD_Panel_UpdatePosSize(physics); break;\
-       case HUD_PANEL_CENTERPRINT: HUD_Panel_UpdatePosSize(centerprint); break;\
-}
+panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \
+HUD_Panel_GetBorder() \
+} ENDS_WITH_CURLY_BRACE
 
-#define HUD_Panel_UpdatePosSizeForId(id) \
-switch(id) { \
-       case HUD_PANEL_WEAPONS: HUD_Panel_UpdatePosSize(weapons) break;\
-       case HUD_PANEL_AMMO: HUD_Panel_UpdatePosSize(ammo) break;\
-       case HUD_PANEL_POWERUPS: HUD_Panel_UpdatePosSize(powerups) break;\
-       case HUD_PANEL_HEALTHARMOR: HUD_Panel_UpdatePosSize(healtharmor) break;\
-       case HUD_PANEL_NOTIFY: HUD_Panel_UpdatePosSize(notify) break;\
-       case HUD_PANEL_TIMER: HUD_Panel_UpdatePosSize(timer) break;\
-       case HUD_PANEL_RADAR: HUD_Panel_UpdatePosSize(radar) break;\
-       case HUD_PANEL_SCORE: HUD_Panel_UpdatePosSize(score) break;\
-       case HUD_PANEL_RACETIMER: HUD_Panel_UpdatePosSize(racetimer) break;\
-       case HUD_PANEL_VOTE: HUD_Panel_UpdatePosSize(vote) break;\
-       case HUD_PANEL_MODICONS: HUD_Panel_UpdatePosSize(modicons) break;\
-       case HUD_PANEL_PRESSEDKEYS: HUD_Panel_UpdatePosSize(pressedkeys) break;\
-       case HUD_PANEL_CHAT: HUD_Panel_UpdatePosSize(chat) break;\
-       case HUD_PANEL_ENGINEINFO: HUD_Panel_UpdatePosSize(engineinfo) break;\
-       default: HUD_Panel_UpdatePosSizeForId_Part2(id)\
-}
 
 #define KN_MAX_ENTRIES 10
 
index 74bf36e..ca8ec19 100644 (file)
@@ -2,8 +2,8 @@
 // q: quoted, n: not quoted
 #define HUD_Write_Cvar_n(cvar) HUD_Write(strcat("seta ", cvar, " ", cvar_string(cvar), "\n"))
 #define HUD_Write_Cvar_q(cvar) HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n"))
-#define HUD_Write_PanelCvar_n(cvar_suf) HUD_Write_Cvar_n(strcat("hud_panel_", panel_name, cvar_suf))
-#define HUD_Write_PanelCvar_q(cvar_suf) HUD_Write_Cvar_q(strcat("hud_panel_", panel_name, cvar_suf))
+#define HUD_Write_PanelCvar_n(cvar_suf) HUD_Write_Cvar_n(strcat("hud_panel_", panel.panel_name, cvar_suf))
+#define HUD_Write_PanelCvar_q(cvar_suf) HUD_Write_Cvar_q(strcat("hud_panel_", panel.panel_name, cvar_suf))
 // Save the config
 void HUD_Panel_ExportCfg(string cfgname)
 {
@@ -52,7 +52,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                float i;
                for (i = 0; i < HUD_PANEL_NUM; ++i)
                {
-                       HUD_Panel_GetName(i);
+                       panel = hud_panel[i];
 
                        HUD_Write_PanelCvar_n("");
                        HUD_Write_PanelCvar_q("_pos");
@@ -219,10 +219,10 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
        myTarget = myPos;
 
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
-               if(i == highlightedPanel || !panel_enabled)
-                       continue;
-
-               HUD_Panel_UpdatePosSizeForId(i);
+               panel = hud_panel[i];
+               if(panel == highlightedPanel) continue;
+               HUD_Panel_UpdatePosSize()
+               if(!panel_enabled) continue;
 
                panel_pos -= '1 1 0' * panel_bg_border;
                panel_size += '2 2 0' * panel_bg_border;
@@ -282,7 +282,8 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
 
 void HUD_Panel_SetPos(vector pos)
 {
-       HUD_Panel_UpdatePosSizeForId(highlightedPanel);
+       panel = highlightedPanel;
+       HUD_Panel_UpdatePosSize()
        vector mySize;
        mySize = panel_size;
 
@@ -304,8 +305,7 @@ void HUD_Panel_SetPos(vector pos)
        string s;
        s = strcat(ftos(pos_x/vid_conwidth), " ", ftos(pos_y/vid_conheight));
 
-       HUD_Panel_GetName(highlightedPanel);
-       cvar_set(strcat("hud_panel_", panel_name, "_pos"), s);
+       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
 }
 
 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
@@ -319,10 +319,10 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
        ratio = mySize_x/mySize_y;
 
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
-               if(i == highlightedPanel || !panel_enabled)
-                       continue;
-
-               HUD_Panel_UpdatePosSizeForId(i);
+               panel = hud_panel[i];
+               if(panel == highlightedPanel) continue;
+               HUD_Panel_UpdatePosSize()
+               if(!panel_enabled) continue;
 
                panel_pos -= '1 1 0' * panel_bg_border;
                panel_size += '2 2 0' * panel_bg_border;
@@ -421,7 +421,8 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
 
 void HUD_Panel_SetPosSize(vector mySize)
 {
-       HUD_Panel_UpdatePosSizeForId(highlightedPanel);
+       panel = highlightedPanel;
+       HUD_Panel_UpdatePosSize()
        vector resizeorigin;
        resizeorigin = panel_click_resizeorigin;
        local noref vector myPos; // fteqcc sucks
@@ -430,7 +431,7 @@ void HUD_Panel_SetPosSize(vector mySize)
        mySize_x = max(0.025 * vid_conwidth, mySize_x);
        mySize_y = max(0.025 * vid_conheight, mySize_y);
 
-       if(highlightedPanel == HUD_PANEL_CHAT) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
+       if(highlightedPanel == HUD_PANEL(CHAT)) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
        {
                mySize_x = max(17 * autocvar_con_chatsize, mySize_x);
                mySize_y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize_y);
@@ -501,20 +502,19 @@ void HUD_Panel_SetPosSize(vector mySize)
        //if(cvar("hud_configure_checkcollisions_debug"))
                //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
 
-       HUD_Panel_GetName(highlightedPanel);
        string s;
        s = strcat(ftos(mySize_x/vid_conwidth), " ", ftos(mySize_y/vid_conheight));
-       cvar_set(strcat("hud_panel_", panel_name, "_size"), s);
+       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
 
        s = strcat(ftos(myPos_x/vid_conwidth), " ", ftos(myPos_y/vid_conheight));
-       cvar_set(strcat("hud_panel_", panel_name, "_pos"), s);
+       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
 }
 
 float pressed_key_time;
 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
 void HUD_Panel_Arrow_Action(float nPrimary)
 {
-       if (highlightedPanel == -1)
+       if(!highlightedPanel)
                return;
 
        hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
@@ -549,7 +549,8 @@ void HUD_Panel_Arrow_Action(float nPrimary)
                        step = (step / 64) * (1 + 2 * (time - pressed_key_time));
        }
 
-       HUD_Panel_UpdatePosSizeForId(highlightedPanel);
+       panel = highlightedPanel;
+       HUD_Panel_UpdatePosSize()
 
        highlightedPanel_initial_pos = panel_pos;
        highlightedPanel_initial_size = panel_size;
@@ -608,7 +609,8 @@ void HUD_Panel_Arrow_Action(float nPrimary)
                HUD_Panel_SetPos(pos);
        }
 
-       HUD_Panel_UpdatePosSizeForId(highlightedPanel);
+       panel = highlightedPanel;
+       HUD_Panel_UpdatePosSize()
 
        if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
        {
@@ -628,15 +630,16 @@ float prevMouseClickedTime; // time during previous left mouse click, to check f
 vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
 
 void HUD_Panel_EnableMenu();
-float tab_panels[HUD_PANEL_NUM];
-float tab_panel, tab_backward;
+entity tab_panels[HUD_PANEL_MAX];
+entity tab_panel;
 vector tab_panel_pos;
+float tab_backward;
 void HUD_Panel_FirstInDrawQ(float id);
 void reset_tab_panels()
 {
        int i;
        for(i = 0; i < HUD_PANEL_NUM; ++i)
-               tab_panels[i] = -1;
+               tab_panels[i] = world;
 }
 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
 {
@@ -687,14 +690,14 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
        {
                if (bInputType == 1) //ctrl has been released
                {
-                       if (tab_panel != -1)
+                       if (tab_panel)
                        {
                                //switch to selected panel
                                highlightedPanel = tab_panel;
                                highlightedAction = 0;
-                               HUD_Panel_FirstInDrawQ(highlightedPanel);
+                               HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
                        }
-                       tab_panel = -1;
+                       tab_panel = world;
                        reset_tab_panels();
                }
        }
@@ -738,15 +741,18 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                //(it should only after every other panel of the hud)
                //It's a minor bug anyway, we can live with it
 
-               float starting_panel;
-               float old_tab_panel = tab_panel;
-               if (tab_panel == -1) //first press of TAB
+               entity starting_panel;
+               entity old_tab_panel = tab_panel;
+               if (!tab_panel) //first press of TAB
                {
-                       if (highlightedPanel != -1)
-                               HUD_Panel_UpdatePosSizeForId(highlightedPanel)
+                       if (highlightedPanel)
+                       {
+                               panel = highlightedPanel;
+                               HUD_Panel_UpdatePosSize()
+                       }
                        else
                                panel_pos = '0 0 0';
-                       starting_panel = highlightedPanel; //can be -1, it means no starting panel
+                       starting_panel = highlightedPanel;
                        tab_panel_pos = panel_pos; //to compute level
                }
                else
@@ -765,35 +771,36 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                level = floor(tab_panel_pos_y / level_height) * level_height; //starting level
                candidate_pos_x = (!tab_backward) ? vid_conwidth : 0;
                start_pos_x = tab_panel_pos_x;
-               tab_panel = -1;
+               tab_panel = world;
                k=0;
                while(++k)
                {
                        for(i = 0; i < HUD_PANEL_NUM; ++i)
                        {
-                               if (i == tab_panels[i] || i == starting_panel)
+                               panel = hud_panel[i];
+                               if (panel == tab_panels[i] || panel == starting_panel)
                                        continue;
-                               HUD_Panel_UpdatePosSizeForId(i)
+                               HUD_Panel_UpdatePosSize()
                                if (panel_pos_y >= level && (panel_pos_y - level) < level_height)
                                if (  ( !tab_backward && panel_pos_x >= start_pos_x && (panel_pos_x < candidate_pos_x || (panel_pos_x == candidate_pos_x && panel_pos_y <= candidate_pos_y)) )
                                        || ( tab_backward && panel_pos_x <= start_pos_x && (panel_pos_x > candidate_pos_x || (panel_pos_x == candidate_pos_x && panel_pos_y >= candidate_pos_y)) )  )
                                {
-                                       tab_panel = i;
+                                       tab_panel = panel;
                                        tab_panel_pos = candidate_pos = panel_pos;
                                }
                        }
-                       if (tab_panel != -1)
+                       if (tab_panel)
                                break;
                        if (k == LEVELS_NUM) //tab_panel not found
                        {
                                reset_tab_panels();
-                               if (old_tab_panel == -2) //this prevents an infinite loop (should not happen normally)
+                               if (!old_tab_panel)
                                {
-                                       tab_panel = -1;
+                                       tab_panel = world;
                                        return true;
                                }
                                starting_panel = old_tab_panel;
-                               old_tab_panel = -2;
+                               old_tab_panel = world;
                                goto find_tab_panel; //u must find tab_panel!
                        }
                        if (!tab_backward)
@@ -810,18 +817,15 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                        }
                }
 
-               tab_panels[tab_panel] = tab_panel;
+               tab_panels[tab_panel.panel_id] = tab_panel;
        }
        else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
        {
                if (bInputType == 1 || mouseClicked)
                        return true;
 
-               if (highlightedPanel != -1)
-               {
-                       HUD_Panel_GetName(highlightedPanel);
-                       cvar_set(strcat("hud_panel_", panel_name), ftos(!(panel_enabled)));
-               }
+               if (highlightedPanel)
+                       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
                else
                        cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
        }
@@ -830,11 +834,11 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                if (bInputType == 1 || mouseClicked)
                        return true;
 
-               if (highlightedPanel != -1)
+               if (highlightedPanel)
                {
-                       HUD_Panel_UpdatePosSizeForId(highlightedPanel);
+                       panel = highlightedPanel;
+                       HUD_Panel_UpdatePosSize()
                        panel_size_copied = panel_size;
-                       highlightedPanel_copied = highlightedPanel;
                }
        }
        else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
@@ -842,10 +846,11 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                if (bInputType == 1 || mouseClicked)
                        return true;
 
-               if (highlightedPanel_copied == -1 || highlightedPanel == -1)
+               if (panel_size_copied == '0 0 0' || !highlightedPanel)
                        return true;
 
-               HUD_Panel_UpdatePosSizeForId(highlightedPanel);
+               panel = highlightedPanel;
+               HUD_Panel_UpdatePosSize()
 
                // reduce size if it'd go beyond screen boundaries
                vector tmp_size = panel_size_copied;
@@ -863,22 +868,20 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                highlightedPanel_backup = highlightedPanel;
 
                s = strcat(ftos(tmp_size_x/vid_conwidth), " ", ftos(tmp_size_y/vid_conheight));
-               HUD_Panel_GetName(highlightedPanel);
-               cvar_set(strcat("hud_panel_", panel_name, "_size"), s);
+               cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
        }
        else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
        {
                if (bInputType == 1 || mouseClicked)
                        return true;
                //restore previous values
-               if (highlightedPanel_backup != -1)
+               if (highlightedPanel_backup)
                {
-                       HUD_Panel_GetName(highlightedPanel_backup);
                        s = strcat(ftos(panel_pos_backup_x/vid_conwidth), " ", ftos(panel_pos_backup_y/vid_conheight));
-                       cvar_set(strcat("hud_panel_", panel_name, "_pos"), s);
+                       cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
                        s = strcat(ftos(panel_size_backup_x/vid_conwidth), " ", ftos(panel_size_backup_y/vid_conheight));
-                       cvar_set(strcat("hud_panel_", panel_name, "_size"), s);
-                       highlightedPanel_backup = -1;
+                       cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
+                       highlightedPanel_backup = world;
                }
        }
        else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
@@ -898,7 +901,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
        {
                if (bInputType == 1)
                        return true;
-               if (highlightedPanel != -1)
+               if (highlightedPanel)
                        HUD_Panel_EnableMenu();
        }
        else if(hit_con_bind)
@@ -916,7 +919,8 @@ float HUD_Panel_Check_Mouse_Pos(float allow_move)
                i = panel_order[j];
                j += 1;
 
-               HUD_Panel_UpdatePosSizeForId(i);
+               panel = hud_panel[i];
+               HUD_Panel_UpdatePosSize()
 
                border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
 
@@ -996,14 +1000,15 @@ void HUD_Panel_Highlight(float allow_move)
                i = panel_order[j];
                j += 1;
 
-               HUD_Panel_UpdatePosSizeForId(i);
+               panel = hud_panel[i];
+               HUD_Panel_UpdatePosSize()
 
                border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
 
                // move
                if(allow_move && mousepos_x > panel_pos_x && mousepos_y > panel_pos_y && mousepos_x < panel_pos_x + panel_size_x && mousepos_y < panel_pos_y + panel_size_y)
                {
-                       highlightedPanel = i;
+                       highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 1;
                        panel_click_distance = mousepos - panel_pos;
@@ -1012,7 +1017,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from topleft border
                else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + 0.5 * panel_size_y)
                {
-                       highlightedPanel = i;
+                       highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 1;
@@ -1023,7 +1028,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from topright border
                else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + 0.5 * panel_size_y)
                {
-                       highlightedPanel = i;
+                       highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 2;
@@ -1035,7 +1040,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from bottomleft border
                else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + panel_size_y + border)
                {
-                       highlightedPanel = i;
+                       highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 3;
@@ -1047,7 +1052,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from bottomright border
                else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + panel_size_y + border)
                {
-                       highlightedPanel = i;
+                       highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 4;
@@ -1056,7 +1061,7 @@ void HUD_Panel_Highlight(float allow_move)
                        return;
                }
        }
-       highlightedPanel = -1;
+       highlightedPanel = world;
        highlightedAction = 0;
 }
 
@@ -1064,8 +1069,7 @@ void HUD_Panel_EnableMenu()
 {
        menu_enabled = 2;
        menu_enabled_time = time;
-       HUD_Panel_GetName(highlightedPanel);
-       localcmd("menu_showhudoptions ", panel_name, "\n");
+       localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
 }
 float mouse_over_panel;
 void HUD_Panel_Mouse()
@@ -1095,21 +1099,21 @@ void HUD_Panel_Mouse()
        {
                if(prevMouseClicked == 0)
                {
-                       if (tab_panel != -1)
+                       if (tab_panel)
                        {
                                //stop ctrl-tab selection
-                               tab_panel = -1;
+                               tab_panel = world;
                                reset_tab_panels();
                        }
                        HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
-                                                                       // and calls HUD_Panel_UpdatePosSizeForId() for the highlighted panel
-                       if (highlightedPanel != -1)
+                                                                       // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
+                       if (highlightedPanel)
                        {
                                highlightedPanel_initial_pos = panel_pos;
                                highlightedPanel_initial_size = panel_size;
                        }
                        // doubleclick check
-                       if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel != -1 && prevMouseClickedPos == mousepos)
+                       if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
                        {
                                mouseClicked = 0; // to prevent spam, I guess.
                                HUD_Panel_EnableMenu();
@@ -1125,9 +1129,12 @@ void HUD_Panel_Mouse()
                        }
                }
                else
-                       HUD_Panel_UpdatePosSizeForId(highlightedPanel);
+               {
+                       panel = highlightedPanel;
+                       HUD_Panel_UpdatePosSize()
+               }
 
-               if (highlightedPanel != -1)
+               if (highlightedPanel)
                {
                        drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
                        if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
@@ -1172,7 +1179,7 @@ void HUD_Panel_Mouse()
                        mouse_over_panel = 0;
                else
                        mouse_over_panel = HUD_Panel_Check_Mouse_Pos(TRUE);
-               if (mouse_over_panel && tab_panel == -1)
+               if (mouse_over_panel && !tab_panel)
                        drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
        }
        // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
index 53dde53..cbda9dc 100644 (file)
@@ -392,43 +392,6 @@ float WR_SWITCHABLE        = 12; // (CSQC) impact effect
 float WR_PLAYERDEATH    = 13; // (SVQC) does not need to do anything
 float WR_GONETHINK     = 14; // (SVQC) logic to run every frame, also if no longer having the weapon as long as the switch away has not been performed
 
-float HUD_PANEL_WEAPONS                = 0;
-float HUD_PANEL_AMMO           = 1;
-float HUD_PANEL_POWERUPS       = 2;
-float HUD_PANEL_HEALTHARMOR    = 3;
-float HUD_PANEL_NOTIFY         = 4;
-float HUD_PANEL_TIMER          = 5;
-float HUD_PANEL_RADAR          = 6;
-float HUD_PANEL_SCORE          = 7;
-float HUD_PANEL_RACETIMER      = 8;
-float HUD_PANEL_VOTE           = 9;
-float HUD_PANEL_MODICONS       = 10;
-float HUD_PANEL_PRESSEDKEYS    = 11;
-float HUD_PANEL_CHAT           = 12;
-float HUD_PANEL_ENGINEINFO     = 13;
-float HUD_PANEL_INFOMESSAGES   = 14;
-float HUD_PANEL_PHYSICS        = 15;
-float HUD_PANEL_CENTERPRINT    = 16;
-float HUD_PANEL_NUM            = 17; // always last panel id + 1, please increment when adding a new panel
-
-string HUD_PANELNAME_WEAPONS           = "weapons";
-string HUD_PANELNAME_AMMO              = "ammo";
-string HUD_PANELNAME_POWERUPS          = "powerups";
-string HUD_PANELNAME_HEALTHARMOR       = "healtharmor";
-string HUD_PANELNAME_NOTIFY            = "notify";
-string HUD_PANELNAME_TIMER             = "timer";
-string HUD_PANELNAME_RADAR             = "radar";
-string HUD_PANELNAME_SCORE             = "score";
-string HUD_PANELNAME_RACETIMER         = "racetimer";
-string HUD_PANELNAME_VOTE              = "vote";
-string HUD_PANELNAME_MODICONS          = "modicons";
-string HUD_PANELNAME_PRESSEDKEYS       = "pressedkeys";
-string HUD_PANELNAME_CHAT              = "chat";
-string HUD_PANELNAME_ENGINEINFO                = "engineinfo";
-string HUD_PANELNAME_INFOMESSAGES      = "infomessages";
-string HUD_PANELNAME_PHYSICS   = "physics";
-string HUD_PANELNAME_CENTERPRINT       = "centerprint";
-
 #define SERVERFLAG_ALLOW_FULLBRIGHT 1
 #define SERVERFLAG_TEAMPLAY 2
 #define SERVERFLAG_PLAYERSTATS 4
index a0f1974..b72380c 100644 (file)
@@ -746,6 +746,7 @@ void Dump_Notifications(float fh, float alsoprint)
        NOTIF_WRITE_HARDCODED("ctf_capture_verbose",             "0",    "Show extra information when someone captures a flag");
        NOTIF_WRITE_HARDCODED("ctf_pickup_enemy_verbose",        "0",    "Show extra information if an enemy picks up a flag");
        NOTIF_WRITE_HARDCODED("ctf_pickup_team_verbose",         "0",    "Show extra information if a team mate picks up a flag");
+       NOTIF_WRITE_HARDCODED("debug",                           "0",    "Print extra debug information on all notification function calls (Requires -DNOTIFICATIONS_DEBUG flag to be enabled on QCSRC compilation)... 0 = disabled, 1 = dprint, 2 = print");
        NOTIF_WRITE_HARDCODED("errors_are_fatal",                "1",    "If a notification fails upon initialization, cause a Host_Error to stop the program");
        NOTIF_WRITE_HARDCODED("frag_verbose",                    "1",    "Show extra information when you frag someone (or when you are fragged");
        NOTIF_WRITE_HARDCODED("item_centerprinttime",            "1.5",  "How long to show item information centerprint messages (like 'You got the Electro' or such)");
@@ -797,13 +798,24 @@ void Notification_GetCvars()
 //  Frontend Notification Pushing
 // ===============================
 
+#ifdef NOTIFICATIONS_DEBUG
+void Debug_Notification(string input)
+{
+       switch(autocvar_notification_debug)
+       {
+               case 1: { dprint(input); break; }
+               case 2: { print(input); break; }
+       }
+}
+#endif
+
 string Local_Notification_sprintf(
        string input, string args, 
        string s1, string s2, string s3, string s4,
        float f1, float f2, float f3, float f4)
 {
        #ifdef NOTIFICATIONS_DEBUG
-       dprint(sprintf(
+       Debug_Notification(sprintf(
                "Local_Notification_sprintf('%s^7', '%s', %s, %s);\n",
                MakeConsoleSafe(input),
                args,
@@ -850,7 +862,7 @@ void Local_Notification_sound(
        if((soundfile != prev_soundfile) || (time >= (prev_soundtime + autocvar_cl_announcer_antispam)))
        {
                #ifdef NOTIFICATIONS_DEBUG
-               dprint(sprintf(
+               Debug_Notification(sprintf(
                        "Local_Notification_sound(world, %f, '%s', %f, %f);\n",
                        soundchannel,
                        sprintf(
@@ -882,7 +894,7 @@ void Local_Notification_sound(
        else
        {
                #ifdef NOTIFICATIONS_DEBUG
-               dprint(sprintf(
+               Debug_Notification(sprintf(
                        "Local_Notification_sound(world, %f, '%s', %f, %f) ^1BLOCKED BY ANTISPAM:^7 prevsnd: '%s', time/prevtime: %f, limit: %f\n",
                        soundchannel,
                        sprintf(
@@ -923,7 +935,7 @@ void Local_Notification_HUD_Notify_Push(
                }
        }
        #ifdef NOTIFICATIONS_DEBUG
-       dprint(sprintf(
+       Debug_Notification(sprintf(
                "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s);\n",
                icon,
                hudargs,
@@ -963,7 +975,7 @@ void Local_Notification_centerprint_generic(
                }
        }
        #ifdef NOTIFICATIONS_DEBUG
-       dprint(sprintf(
+       Debug_Notification(sprintf(
                "Local_Notification_centerprint_generic('%s^7', '%s', %d, %d, %d, %d);\n",
                MakeConsoleSafe(input),
                durcnt,
@@ -986,7 +998,7 @@ void Local_Notification(float net_type, float net_name, ...count)
        if not(notif.nent_enabled)
        {
                #ifdef NOTIFICATIONS_DEBUG
-               dprint(sprintf(
+               Debug_Notification(sprintf(
                        "Local_Notification(%s, %s): Entity was disabled...\n",
                        Get_Notif_TypeName(net_type),
                        notif.nent_name
@@ -1032,7 +1044,7 @@ void Local_Notification(float net_type, float net_name, ...count)
        float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3), float) : 0);
 
        #ifdef NOTIFICATIONS_DEBUG
-       dprint(sprintf(
+       Debug_Notification(sprintf(
                "Local_Notification(%s, %s, %s, %s);\n",
                Get_Notif_TypeName(net_type),
                notif.nent_name,
@@ -1167,7 +1179,7 @@ void Read_Notification(float is_new)
        if(net_type == MSG_CENTER_CPID)
        {
                #ifdef NOTIFICATIONS_DEBUG
-               dprint(sprintf(
+               Debug_Notification(sprintf(
                        "Read_Notification(%d) at %f: net_type = %s, net_name = %d\n",
                        is_new,
                        time,
@@ -1200,7 +1212,7 @@ void Read_Notification(float is_new)
                if not(notif) { backtrace("Read_Notification: Could not find notification entity!\n"); return; }
 
                #ifdef NOTIFICATIONS_DEBUG
-               dprint(sprintf(
+               Debug_Notification(sprintf(
                        "Read_Notification(%d) at %f: net_type = %s, net_name = %s\n",
                        is_new,
                        time,
@@ -1237,7 +1249,7 @@ void Net_Notification_Remove()
        if not(self) { backtrace(sprintf("Net_Notification_Remove() at %f: Missing self!?\n", time)); return; }
        
        #ifdef NOTIFICATIONS_DEBUG
-       dprint(sprintf(
+       Debug_Notification(sprintf(
                "Net_Notification_Remove() at %f: %s '%s - %s' notification\n",
                time,
                ((self.nent_net_name == -1) ? "Killed" : "Removed"),
@@ -1350,7 +1362,7 @@ void Kill_Notification(
        if(checkargs != "") { backtrace(sprintf("Incorrect usage of Kill_Notification: %s\n", checkargs)); return; }
 
        #ifdef NOTIFICATIONS_DEBUG
-       dprint(sprintf(
+       Debug_Notification(sprintf(
                "Kill_Notification(%d, '%s', %s, %d);\n",
                broadcast,
                client.netname,
@@ -1411,7 +1423,7 @@ void Kill_Notification(
        {
                if(net_type)
                {
-                       if(killed_cpid != NO_CPID)
+                       if((killed_cpid != NO_CPID) && (notif.nent_net_type == MSG_CENTER))
                        {
                                if(notif.owner.nent_cpid == killed_cpid)
                                {
@@ -1484,7 +1496,7 @@ void Send_Notification(
        float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1), float) : 0);
        float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2), float) : 0);
        float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3), float) : 0);
-       dprint(sprintf(
+       Debug_Notification(sprintf(
                "Send_Notification(%d, %s, %s, %s, %s);\n",
                broadcast,
                Get_Notif_TypeName(net_type),
@@ -1540,7 +1552,7 @@ void Send_Notification_WOVA(
        entity notif = Get_Notif_Ent(net_type, net_name);
        
        #ifdef NOTIFICATIONS_DEBUG
-       dprint(sprintf(
+       Debug_Notification(sprintf(
                "Send_Notification_WOVA(%d, %s, %s, %s, %s);\n",
                broadcast,
                Get_Notif_TypeName(net_type),
index 2f9c24b..171be6a 100644 (file)
@@ -66,6 +66,10 @@ void Create_Notification_Entity(
 
 void Dump_Notifications(float fh, float alsoprint);
 
+#ifdef NOTIFICATIONS_DEBUG
+void Debug_Notification(string input);
+#endif
+
 void Local_Notification(float net_type, float net_name, ...count);
 void Local_Notification_WOVA(
        float net_type, float net_name,
@@ -528,7 +532,7 @@ void Send_Notification_WOVA(
        MSG_CENTER_NOTIF(1, CENTER_NIX_COUNTDOWN,               0, 2, "item_wepname",  CPID_NIX,              "1 f2", _("^F2^COUNT^BG until weapon change...\nNext weapon: ^F1%s"), "") \
        MSG_CENTER_NOTIF(1, CENTER_NIX_NEWWEAPON,               0, 1, "item_wepname",  CPID_NIX,              "0 0", _("^F2Active weapon: ^F1%s"), "") \
        MSG_CENTER_NOTIF(1, CENTER_OVERTIME_FRAG,               0, 0, "",              CPID_OVERTIME,         "0 0", _("^F2Now playing ^F4OVERTIME^F2!\nKeep fragging until we have a winner!"), _("^F2Now playing ^F4OVERTIME^F2!\nKeep scoring until we have a winner!")) \
-       MSG_CENTER_NOTIF(1, CENTER_OVERTIME_TIME,               0, 1, "f1time",        CPID_OVERTIME,         "0 0", _("^F2Now playing ^F4OVERTIME^F2!\nAdded ^F4%s^F2 to the game!"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_OVERTIME_TIME,               0, 1, "f1time",        CPID_OVERTIME,         "0 0", _("^F2Now playing ^F4OVERTIME^F2!\n^BGAdded ^F4%s^BG to the game!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_POWERDOWN_INVISIBILITY,      0, 0, "",              CPID_POWERUP,          "0 0", _("^F2Invisibility has worn off"), "") \
        MSG_CENTER_NOTIF(1, CENTER_POWERDOWN_SHIELD,            0, 0, "",              CPID_POWERUP,          "0 0", _("^F2Shield has worn off"), "") \
        MSG_CENTER_NOTIF(1, CENTER_POWERDOWN_SPEED,             0, 0, "",              CPID_POWERUP,          "0 0", _("^F2Speed has worn off"), "") \
@@ -688,6 +692,7 @@ var float autocvar_notification_show_sprees_info_specialonly = TRUE;
 var float autocvar_notification_errors_are_fatal = TRUE;
 var float autocvar_notification_lifetime_runtime = 0.5;
 var float autocvar_notification_lifetime_mapload = 10;
+var float autocvar_notification_debug = FALSE;
 
 #ifdef SVQC
 .float FRAG_VERBOSE;
index e77b764..c1ef62d 100644 (file)
@@ -92,6 +92,20 @@ string Team_ColorName(float teamid)
     return NAME_NEUTRAL;
 }
 
+// used for replacement in filenames or such where the name CANNOT be allowed to be translated
+string Static_Team_ColorName(float teamid)
+{
+    switch(teamid)
+    {
+               case NUM_TEAM_1: return STATIC_NAME_TEAM_1;
+       case NUM_TEAM_2: return STATIC_NAME_TEAM_2;
+       case NUM_TEAM_3: return STATIC_NAME_TEAM_3;
+       case NUM_TEAM_4: return STATIC_NAME_TEAM_4;
+       }
+       
+    return NAME_NEUTRAL;
+}
+
 float Team_ColorToTeam(string team_color)
 {
        switch(strtolower(team_color))
@@ -141,6 +155,10 @@ float Team_TeamToNumber(float teamid)
 #define Team_ColorName_Lower(teamid) strtolower(Team_ColorName(teamid))
 #define Team_ColorName_Upper(teamid) strtoupper(Team_ColorName(teamid))
 
+// used for replacement in filenames or such where the name CANNOT be allowed to be translated
+#define Static_Team_ColorName_Lower(teamid) strtolower(Static_Team_ColorName(teamid))
+#define Static_Team_ColorName_Upper(teamid) strtoupper(Static_Team_ColorName(teamid))
+
 #define Team_FullName(teamid) strcat(Team_ColorName(teamid), " ", NAME_TEAM, "^7")
 #define Team_ColoredFullName(teamid) strcat(Team_ColorCode(teamid), Team_ColorName(teamid), " ", NAME_TEAM, "^7")
 
index df910e3..e9bd01c 100644 (file)
@@ -264,34 +264,6 @@ float get_model_parameters_fixbone;
 string get_model_parameters_desc;
 float get_model_parameters(string mod, float skn); // call with string_null to clear; skin -1 means mod is the filename of the txt file and is to be split
 
-// stupid stupid stupid FTEQCC has a max limit on macro sizes, let's work around by splitting the macro into two macros! :(
-#define HUD_Panel_GetName_Part2(id) \
-switch(id) {\
-       case HUD_PANEL_ENGINEINFO: panel_name = HUD_PANELNAME_ENGINEINFO; break; \
-       case HUD_PANEL_INFOMESSAGES: panel_name = HUD_PANELNAME_INFOMESSAGES; break; \
-       case HUD_PANEL_PHYSICS: panel_name = HUD_PANELNAME_PHYSICS; break; \
-       case HUD_PANEL_CENTERPRINT: panel_name = HUD_PANELNAME_CENTERPRINT; break; \
-} ENDS_WITH_CURLY_BRACE
-
-// Get name of specified panel id
-#define HUD_Panel_GetName(id) \
-switch(id) { \
-       case HUD_PANEL_WEAPONS: panel_name = HUD_PANELNAME_WEAPONS; break; \
-       case HUD_PANEL_AMMO: panel_name = HUD_PANELNAME_AMMO; break; \
-       case HUD_PANEL_POWERUPS: panel_name = HUD_PANELNAME_POWERUPS; break; \
-       case HUD_PANEL_HEALTHARMOR: panel_name = HUD_PANELNAME_HEALTHARMOR; break; \
-       case HUD_PANEL_NOTIFY: panel_name = HUD_PANELNAME_NOTIFY; break; \
-       case HUD_PANEL_TIMER: panel_name = HUD_PANELNAME_TIMER; break; \
-       case HUD_PANEL_RADAR: panel_name = HUD_PANELNAME_RADAR; break; \
-       case HUD_PANEL_SCORE: panel_name = HUD_PANELNAME_SCORE; break; \
-       case HUD_PANEL_RACETIMER: panel_name = HUD_PANELNAME_RACETIMER; break; \
-       case HUD_PANEL_VOTE: panel_name = HUD_PANELNAME_VOTE; break; \
-       case HUD_PANEL_MODICONS: panel_name = HUD_PANELNAME_MODICONS; break; \
-       case HUD_PANEL_PRESSEDKEYS: panel_name = HUD_PANELNAME_PRESSEDKEYS; break; \
-       case HUD_PANEL_CHAT: panel_name = HUD_PANELNAME_CHAT; break; \
-    default: HUD_Panel_GetName_Part2(id)\
-}
-
 vector vec2(vector v);
 
 #ifndef MENUQC
index 0a3a55c..f009716 100644 (file)
@@ -43,6 +43,7 @@
 #include "xonotic/slider_resolution.c"
 #include "xonotic/checkbox.c"
 #include "xonotic/checkbox_string.c"
+#include "xonotic/weaponarenacheckbox.c"
 #include "xonotic/radiobutton.c"
 #include "xonotic/nexposee.c"
 #include "xonotic/rootdialog.c"
index e412823..40fb4cc 100644 (file)
@@ -102,65 +102,14 @@ string XonoticMutatorsDialog_toString(entity me)
                s = strcat(s, ", ", _("No powerups"));
        if(cvar("g_powerups") > 0)
                s = strcat(s, ", ", _("Powerups"));
+       if(cvar("g_touchexplode") > 0)
+               s = strcat(s, ", ", _("Touch explode"));
        if(s == "")
                return ZCTX(_("MUT^None"));
        else
                return substring(s, 2, strlen(s) - 2);
 }
 
-
-
-// WARNING: dirty hack. TODO clean this up by putting this behaviour in extra classes.
-void loadCvarsLaserWeaponArenaWeaponButton(entity me)
-{
-       tokenize_console(cvar_string("g_weaponarena"));
-       me.checked = (argv(0) == me.cvarValue);
-}
-
-void saveCvarsLaserWeaponArenaWeaponButton(entity me)
-{
-       string suffix;
-
-       suffix = "";
-       if(me.cvarValue != "laser" && me.cvarValue != "most")
-               if(cvar("menu_weaponarena_with_laser"))
-                       suffix = " laser";
-       if(me.checked)
-               cvar_set("g_weaponarena", strcat(me.cvarValue, suffix));
-       else
-               cvar_set("g_weaponarena", me.cvarOffValue);
-}
-
-.void(entity) draw_weaponarena;
-.void(entity) saveCvars_weaponarena;
-void saveCvarsLaserWeaponArenaLaserButton(entity me)
-{
-       // run the old function
-       me.saveCvars_weaponarena(me);
-
-       me.disabled = ((cvar_string("g_weaponarena") == "0") || (cvar_string("g_weaponarena") == "laser") || (cvar_string("g_weaponarena") == "most"));
-
-       if not(me.disabled)
-       {
-               // check for the laser suffix
-               string s;
-               s = cvar_string("g_weaponarena");
-               if(me.checked && substring(s, strlen(s) - 6, 6) != " laser")
-                       s = strcat(s, " laser");
-               else if(!me.checked && substring(s, strlen(s) - 6, 6) == " laser")
-                       s = substring(s, 0, strlen(s) - 6);
-               cvar_set("g_weaponarena", s);
-       }
-}
-
-void preDrawLaserWeaponArenaLaserButton(entity me)
-{
-       me.disabled = ((cvar_string("g_weaponarena") == "0") || (cvar_string("g_weaponarena") == "laser") || (cvar_string("g_weaponarena") == "most"));
-       // run the old function
-       me.draw_weaponarena(me);
-}
-// WARNING: end of dirty hack. Do not try this at home.
-
 float checkCompatibility_pinata(entity me)
 {
        if(cvar("g_minstagib"))
@@ -187,12 +136,25 @@ float checkCompatibility_newtoys(entity me)
                return 0;
        return 1;
 }
+float checkCompatibility_weaponarena_weapon(entity me)
+{
+       if(cvar("g_minstagib"))
+               return 0;
+       if(cvar_string("g_weaponarena") == "most")
+               return 0;
+       if(cvar_string("g_weaponarena") == "all")
+               return 0;
+       if(cvar_string("g_weaponarena") == "0")
+               return 0;
+       if(cvar_string("g_start_weapon_laser") == "0")
+               return 0;
+       return 1;
+}
 
 void XonoticMutatorsDialog_fill(entity me)
 {
        entity e, s, w;
        float i, j;
-       string str, hstr;
        me.TR(me);
                me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
        me.TR(me);
@@ -200,6 +162,9 @@ void XonoticMutatorsDialog_fill(entity me)
                me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_dodging", _("Dodging")));
        me.TR(me);
                me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_touchexplode", _("Touch explode")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
                me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_cloaked", _("Cloaked")));
        me.TR(me);
                me.TDempty(me, 0.2);
@@ -254,10 +219,11 @@ void XonoticMutatorsDialog_fill(entity me)
        me.TR(me);
 
        me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Weapon arenas:")));
+               me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
        me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
+               me.TD(me, 1, 2, e = makeXonoticRadioButton(1, "g_weaponarena", "menu_weaponarena", _("Weapon arenas:")));
+                       e.getCvarValueFromCvar = TRUE;
+                       e.cvarOffValue = "0";
        for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
        {
                w = get_weaponinfo(i);
@@ -265,47 +231,38 @@ void XonoticMutatorsDialog_fill(entity me)
                        continue;
                if(j & 1 == 0)
                        me.TR(me);
-               str = w.netname;
-               hstr = w.message;
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", strzone(str), strzone(hstr)));
-                       e.cvarOffValue = "0";
-                       // custom load/save logic that ignores a " laser" suffix, or adds it 
-                       e.loadCvars = loadCvarsLaserWeaponArenaWeaponButton;
-                       e.saveCvars = saveCvarsLaserWeaponArenaWeaponButton;
-                       e.loadCvars(e);
+               me.TD(me, 1, 1.8, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.message)));
+                       setDependentWeird(e, checkCompatibility_weaponarena_weapon);
                ++j;
        }
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "menu_weaponarena_with_laser", _("with laser")));
-                       // hook the draw function to gray it out
-                       e.draw_weaponarena = e.draw;
-                       e.draw = preDrawLaserWeaponArenaLaserButton;
-                       // hook the save function to notify about the cvar
-                       e.saveCvars_weaponarena = e.saveCvars;
-                       e.saveCvars = saveCvarsLaserWeaponArenaLaserButton;
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "most", _("Most weapons")));
+                       e.cvarOffValue = "0";
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "all", _("All weapons")));
+                       e.cvarOffValue = "0";
        me.TR(me);
                me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_minstagib", string_null, _("MinstaGib")));
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_minstagib", "1", _("MinstaGib")));
+                       e.cvarOffValue = "0";
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_nix", string_null, _("NIX")));
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_nix", "1", _("NIX")));
+                       e.cvarOffValue = "0";
        me.TR(me);
                me.TDempty(me, 0.4);
                me.TD(me, 1, 1.6, e = makeXonoticCheckBox(0, "g_nix_with_laser", _("with laser")));
                        setDependent(e, "g_nix", 1, 1);
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "most", _("Most weapons")));
-                       e.cvarOffValue = "0";
-       me.TR(me);
-               me.TDempty(me, 0.2);
                me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_start_weapon_laser", "0", _("No start weapons")));
                        e.cvarOffValue = "-1";
-                       makeMulti(e, "g_start_weapon_shotgun g_start_weapon_uzi g_start_weapon_grenadelauncher g_start_weapon_minelayer g_start_weapon_electro g_start_weapon_crylink g_start_weapon_nex g_start_weapon_hagar g_start_weapon_rocketlauncher g_start_weapon_rifle g_start_weapon_hlac g_start_weapon_seeker g_start_weapon_minstanex g_start_weapon_hook g_start_weapon_porto g_start_weapon_tuba g_start_weapon_minelayer");
+                       makeMulti(e, "g_start_weapon_shotgun g_start_weapon_uzi g_start_weapon_grenadelauncher g_start_weapon_minelayer g_start_weapon_electro g_start_weapon_crylink g_start_weapon_nex g_start_weapon_hagar g_start_weapon_rocketlauncher g_start_weapon_porto g_start_weapon_minstanex g_start_weapon_hook g_start_weapon_hlac g_start_weapon_rifle g_start_weapon_fireball g_start_weapon_seeker g_start_weapon_tuba");
 
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
index 8c353ea..4ac5aa7 100644 (file)
@@ -13,6 +13,7 @@ CLASS(XonoticRadioButton) EXTENDS(RadioButton)
        ATTRIB(XonoticRadioButton, cvarName, string, string_null)
        ATTRIB(XonoticRadioButton, cvarValue, string, string_null)
        ATTRIB(XonoticRadioButton, cvarOffValue, string, string_null)
+       ATTRIB(XonoticRadioButton, getCvarValueFromCvar, float, 0)
        METHOD(XonoticRadioButton, loadCvars, void(entity))
        METHOD(XonoticRadioButton, saveCvars, void(entity))
 
@@ -98,7 +99,12 @@ void XonoticRadioButton_saveCvars(entity me)
                if(me.cvarName)
                {
                        if(me.checked)
-                               cvar_set(me.cvarName, me.cvarValue);
+                       {
+                               if(me.getCvarValueFromCvar)
+                                       cvar_set(me.cvarName, cvar_string(me.cvarValue));
+                               else
+                                       cvar_set(me.cvarName, me.cvarValue);
+                       }
                        else if(me.cvarOffValue)
                                cvar_set(me.cvarName, me.cvarOffValue);
                }
diff --git a/qcsrc/menu/xonotic/weaponarenacheckbox.c b/qcsrc/menu/xonotic/weaponarenacheckbox.c
new file mode 100644 (file)
index 0000000..163f9c6
--- /dev/null
@@ -0,0 +1,57 @@
+#ifdef INTERFACE
+CLASS(XonoticWeaponarenaCheckBox) EXTENDS(CheckBox)
+       METHOD(XonoticWeaponarenaCheckBox, configureXonoticWeaponarenaCheckBox, void(entity, string, string))
+       METHOD(XonoticWeaponarenaCheckBox, setChecked, void(entity, float))
+       ATTRIB(XonoticWeaponarenaCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticWeaponarenaCheckBox, image, string, SKINGFX_CHECKBOX)
+       ATTRIB(XonoticWeaponarenaCheckBox, netname, string, string_null)
+
+       METHOD(XonoticWeaponarenaCheckBox, loadCvars, void(entity))
+       METHOD(XonoticWeaponarenaCheckBox, saveCvars, void(entity))
+ENDCLASS(XonoticWeaponarenaCheckBox)
+entity makeXonoticWeaponarenaCheckBox(string, string);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticWeaponarenaCheckBox(string theWeapon, string theText)
+{
+       entity me;
+       me = spawnXonoticWeaponarenaCheckBox();
+       me.configureXonoticWeaponarenaCheckBox(me, theWeapon, theText);
+       return me;
+}
+void XonoticWeaponarenaCheckBox_configureXonoticWeaponarenaCheckBox(entity me, string theWeapon, string theText)
+{
+       me.netname = theWeapon;
+       me.checked = FALSE;
+       me.loadCvars(me);
+       me.configureCheckBox(me, theText, me.fontSize, me.image);
+}
+void XonoticWeaponarenaCheckBox_setChecked(entity me, float foo)
+{
+       me.checked = !me.checked;
+       me.saveCvars(me);
+}
+void XonoticWeaponarenaCheckBox_loadCvars(entity me)
+{
+       float n = tokenize_console(cvar_string("menu_weaponarena"));
+       float i;
+       for(i=0; i<n; ++i)
+       {
+               if(argv(i) == me.netname)
+               {
+                       me.checked = TRUE;
+                       break;
+               }
+       }
+}
+
+void XonoticWeaponarenaCheckBox_saveCvars(entity me)
+{
+       if(me.checked)
+               localcmd(strcat("\nmenu_cmd addtolist menu_weaponarena ", me.netname, "\n"));
+       else
+               localcmd(strcat("\nmenu_cmd removefromlist menu_weaponarena ", me.netname, "\n"));
+       localcmd("\ng_weaponarena \"$menu_weaponarena\"\n");
+}
+#endif
index cfa6133..ad8157a 100644 (file)
@@ -1228,3 +1228,7 @@ float autocvar_physics_ode;
 float autocvar_g_physical_items;
 float autocvar_g_physical_items_damageforcescale;
 float autocvar_g_physical_items_reset;
+float autocvar_g_touchexplode_radius;
+float autocvar_g_touchexplode_damage;
+float autocvar_g_touchexplode_edgedamage;
+float autocvar_g_touchexplode_force;
index 93289a4..5d29bf7 100644 (file)
@@ -592,21 +592,6 @@ void FixPlayermodel()
                                setcolor(self, stof(autocvar_sv_defaultplayercolors));
 }
 
-void PlayerTouchExplode(entity p1, entity p2)
-{
-       vector org;
-       org = (p1.origin + p2.origin) * 0.5;
-       org_z += (p1.mins_z + p2.mins_z) * 0.5;
-
-       te_explosion(org);
-
-       entity e;
-       e = spawn();
-       setorigin(e, org);
-       RadiusDamage(e, world, g_touchexplode_damage, g_touchexplode_edgedamage, g_touchexplode_radius, world, g_touchexplode_force, DEATH_TOUCHEXPLODE, world);
-       remove(e);
-}
-
 /*
 =============
 PutClientInServer
@@ -2439,8 +2424,6 @@ void PlayerUseKey()
        MUTATOR_CALLHOOK(PlayerUseKey);
 }
 
-.float touchexplode_time;
-
 /*
 =============
 PlayerPreThink
@@ -2641,25 +2624,6 @@ void PlayerPreThink (void)
 
                        return;
                }
-               // FIXME from now on self.deadflag is always 0 (and self.health is never < 1)
-               // so (self.deadflag == DEAD_NO) is always true in the code below
-
-               if(g_touchexplode)
-               if(time > self.touchexplode_time)
-               if(self.classname == "player")
-               if(self.deadflag == DEAD_NO)
-               if not(IS_INDEPENDENT_PLAYER(self))
-               FOR_EACH_PLAYER(other) if(self != other)
-               {
-                       if(time > other.touchexplode_time)
-                       if(other.deadflag == DEAD_NO)
-                       if not(IS_INDEPENDENT_PLAYER(other))
-                       if(boxesoverlap(self.absmin, self.absmax, other.absmin, other.absmax))
-                       {
-                               PlayerTouchExplode(self, other);
-                               self.touchexplode_time = other.touchexplode_time = time + 0.2;
-                       }
-               }
 
                if(g_lms && !self.deadflag && autocvar_g_lms_campcheck_interval)
                {
@@ -2684,7 +2648,10 @@ void PlayerPreThink (void)
                                        Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_LMS_CAMPCHECK);
                                        // FIXME KadaverJack: gibbing player here causes playermodel to bounce around, instead of eye.md3
                                        // I wasn't able to find out WHY that happens, so I put a workaround in place that shall prevent players from being gibbed :(
-                                       Damage(self, self, self, bound(0, autocvar_g_lms_campcheck_damage, self.health + self.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP, self.origin, '0 0 0');
+                                       if(self.vehicle)
+                                               Damage(self.vehicle, self, self, autocvar_g_lms_campcheck_damage * 2, DEATH_CAMP, self.vehicle.origin, '0 0 0');
+                                       else
+                                               Damage(self, self, self, bound(0, autocvar_g_lms_campcheck_damage, self.health + self.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP, self.origin, '0 0 0');
                                }
                                self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval;
                                self.lms_traveled_distance = 0;
index 6ddf7b6..a929e36 100644 (file)
@@ -358,7 +358,7 @@ void RaceCarPhysics()
                rigvel_z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
                rigvel_xy = vec2(rigvel);
 
-               if(g_bugrigs_planar_movement_car_jumping && !g_touchexplode) // touchexplode is a better way to handle collisions
+               if(g_bugrigs_planar_movement_car_jumping)
                        mt = MOVE_NORMAL;
                else
                        mt = MOVE_NOMONSTERS;
index 1f55aff..3e564e3 100644 (file)
@@ -691,7 +691,7 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
                        
                        if(accepted > 0)
                        {
-                               string reason = ((argc > next_token) ? substring(vote_command, argv_start_index(next_token), argv_end_index(-1) - argv_start_index(next_token)) : "No reason provided");
+                               string reason = ((argc > next_token) ? substring(vote_command, argv_start_index(next_token), strlen(vote_command) - argv_start_index(next_token)) : "No reason provided");
                                string command_arguments;
                                
                                if(first_command == "kickban")
index fb179a3..16a6a04 100644 (file)
@@ -372,7 +372,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
        string deathlocation = (autocvar_notification_server_allows_location ? NearestLocation(targ.death_origin) : "");
 
        #ifdef NOTIFICATIONS_DEBUG
-       dprint(
+       Debug_Notification(
                sprintf(
                        "Obituary(%s, %s, %s, %s = %d);\n",
                        attacker.netname,
index 0322205..d8ce88c 100644 (file)
@@ -1339,7 +1339,7 @@ void IntermissionThink()
                && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) )
        {
                self.autoscreenshot = -1;
-               if(clienttype(self) == CLIENTTYPE_REAL) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"", GetMapname(), strftime(FALSE, "%s"))); }
+               if(clienttype(self) == CLIENTTYPE_REAL) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"\n", GetMapname(), strftime(FALSE, "%s"))); }
                return;
        }
 
@@ -1581,7 +1581,7 @@ void NextLevel()
                PlayerStats_AddGlobalInfo(e);
        PlayerStats_Shutdown();
        WeaponStats_Shutdown();
-
+       
        Kill_Notification(NOTIF_ALL, world, MSG_CENTER, 0); // kill all centerprints now
 
        if(autocvar_sv_eventlog)
@@ -1667,7 +1667,7 @@ void InitiateOvertime() // ONLY call this if InitiateSuddenDeath returned true
        tl += autocvar_timelimit_overtime;
        cvar_set("timelimit", ftos(tl));
 
-       Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_TIME, autocvar_timelimit_overtime);
+       Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_TIME, autocvar_timelimit_overtime * 60);
 }
 
 float GetWinningCode(float fraglimitreached, float equality)
index 9504deb..fa8be67 100644 (file)
@@ -993,12 +993,6 @@ float g_bugrigs_speed_ref;
 float g_bugrigs_speed_pow;
 float g_bugrigs_steer;
 
-float g_touchexplode;
-float g_touchexplode_radius;
-float g_touchexplode_damage;
-float g_touchexplode_edgedamage;
-float g_touchexplode_force;
-
 float sv_autotaunt;
 float sv_taunt;
 
@@ -1014,6 +1008,8 @@ void readlevelcvars(void)
                MUTATOR_ADD(mutator_spawn_near_teammate);
        if(cvar("g_physical_items"))
                MUTATOR_ADD(mutator_physical_items);
+       if(cvar("g_touchexplode"))
+               MUTATOR_ADD(mutator_touchexplode);
        if(!g_minstagib)
        {
                if(cvar("g_invincible_projectiles"))
@@ -1053,12 +1049,6 @@ void readlevelcvars(void)
     g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow");
     g_bugrigs_steer = cvar("g_bugrigs_steer");
 
-    g_touchexplode = cvar("g_touchexplode");
-    g_touchexplode_radius = cvar("g_touchexplode_radius");
-    g_touchexplode_damage = cvar("g_touchexplode_damage");
-    g_touchexplode_edgedamage = cvar("g_touchexplode_edgedamage");
-    g_touchexplode_force = cvar("g_touchexplode_force");
-
        sv_clones = cvar("sv_clones");
        sv_foginterval = cvar("sv_foginterval");
        g_cloaked = cvar("g_cloaked");
index 051eaa3..98b9b40 100644 (file)
@@ -19,6 +19,7 @@ void dompoint_captured ()
 {
        entity head;
        float old_delay, old_team, real_team;
+       string msg = "dom-neut";
 
        // now that the delay has expired, switch to the latest team to lay claim to this point
        head = self.owner;
@@ -74,8 +75,16 @@ void dompoint_captured ()
        SUB_UseTargets ();
        self.delay = old_delay;
        self.team = old_team;
+       
+       switch(self.team)
+       {
+               case NUM_TEAM_1: msg = "dom-red"; break;
+               case NUM_TEAM_2: msg = "dom-blue"; break;
+               case NUM_TEAM_3: msg = "dom-yellow"; break;
+               case NUM_TEAM_4: msg = "dom-pink"; break;
+       }
 
-       WaypointSprite_UpdateSprites(self.sprite, strcat("dom-", Team_ColorName_Lower(self.goalentity.team)), "", "");
+       WaypointSprite_UpdateSprites(self.sprite, msg, "", "");
        
        total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
        for(head = world; (head = find(head, classname, "dom_controlpoint")) != world; )
diff --git a/qcsrc/server/mutators/mutator_touchexplode.qc b/qcsrc/server/mutators/mutator_touchexplode.qc
new file mode 100644 (file)
index 0000000..f51ed65
--- /dev/null
@@ -0,0 +1,46 @@
+.float touchexplode_time;
+
+void PlayerTouchExplode(entity p1, entity p2)
+{
+       vector org;
+       org = (p1.origin + p2.origin) * 0.5;
+       org_z += (p1.mins_z + p2.mins_z) * 0.5;
+
+       sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
+       pointparticles(particleeffectnum("explosion_small"), org, '0 0 0', 1);
+
+       entity e;
+       e = spawn();
+       setorigin(e, org);
+       RadiusDamage(e, world, autocvar_g_touchexplode_damage, autocvar_g_touchexplode_edgedamage, autocvar_g_touchexplode_radius, world, autocvar_g_touchexplode_force, DEATH_TOUCHEXPLODE, world);
+       remove(e);
+}
+
+MUTATOR_HOOKFUNCTION(touchexplode_PlayerThink)
+{
+       if(time > self.touchexplode_time)
+       if not(gameover)
+       if(IS_PLAYER(self))
+       if(self.deadflag == DEAD_NO)
+       if not(IS_INDEPENDENT_PLAYER(self))
+       FOR_EACH_PLAYER(other) if(self != other)
+       {
+               if(time > other.touchexplode_time)
+               if(other.deadflag == DEAD_NO)
+               if not(IS_INDEPENDENT_PLAYER(other))
+               if(boxesoverlap(self.absmin, self.absmax, other.absmin, other.absmax))
+               {
+                       PlayerTouchExplode(self, other);
+                       self.touchexplode_time = other.touchexplode_time = time + 0.2;
+               }
+       }
+
+       return FALSE;
+}
+
+MUTATOR_DEFINITION(mutator_touchexplode)
+{
+       MUTATOR_HOOK(PlayerPreThink, touchexplode_PlayerThink, CBC_ORDER_ANY);
+
+       return FALSE;
+}
index 617155b..7665cc8 100644 (file)
@@ -17,5 +17,6 @@ MUTATOR_DECLARATION(mutator_spawn_near_teammate);
 MUTATOR_DECLARATION(mutator_physical_items);
 MUTATOR_DECLARATION(mutator_vampire);
 MUTATOR_DECLARATION(mutator_superspec);
+MUTATOR_DECLARATION(mutator_touchexplode);
 
 MUTATOR_DECLARATION(sandbox);
index bb23eb6..edef590 100644 (file)
@@ -238,6 +238,7 @@ mutators/mutator_spawn_near_teammate.qc
 mutators/mutator_physical_items.qc
 mutators/sandbox.qc
 mutators/mutator_superspec.qc
+mutators/mutator_touchexplode.qc
 
 ../warpzonelib/anglestransform.qc
 ../warpzonelib/mathlib.qc
index 9358cd7..8f18d84 100644 (file)
@@ -31,6 +31,7 @@ void turret_machinegun_std_init()
     }
 
     self.damage_flags |= TFL_DMG_HEADSHAKE;
+       self.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK;
 
     // Our fire routine
     self.turret_firefunc  = turret_machinegun_attack;
index e23cc70..a79fcc6 100644 (file)
@@ -1268,7 +1268,7 @@ float vehicle_initialize(string  net_name,
     self.vehicle_exit        = exitfunc;
     self.vehicle_enter       = enterproc;
     self.PlayerPhysplug      = physproc;
-    self.event_damage        = vehicles_damage;
+    self.event_damage        = func_null;
     self.touch               = vehicles_touch;
     self.think               = vehicles_spawn;
     self.nextthink           = time;
index b4b79ab..4d9a0fa 100644 (file)
@@ -236,6 +236,9 @@ void W_Hagar_Attack2_Load_Release (void)
 void W_Hagar_Attack2_Load (void)
 {
        // loadable hagar secondary attack, must always run each frame
+       
+       if(time < game_starttime)
+               return;
 
        float loaded, enough_ammo;
        loaded = self.hagar_load >= autocvar_g_balance_hagar_secondary_load_max;
index 1301bda..0f80a81 100644 (file)
@@ -40,7 +40,6 @@
 \g_pinata\Players will drop all weapons they possessed when they are killed
 \g_weapon_stay\Weapons stay after they are picked up
 \g_weaponarena\Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.
-\menu_weaponarena_with_laser\Also enable the laser in the weapon arena
 \g_minstagib\Players will be given the Minstanex, which is a railgun with infinite damage. If the player runs out of ammo, he will have 10 seconds to find some or if he fails to do so, face death. The secondary fire mode is a laser which does not inflict any damage and is good for doing trickjumps.
 \g_nix\No items Xonotic - instead of pickup items, everyone plays with the same weapon. After some time, a countdown will start, after which everyone will switch to another weapon.
 \g_nix_with_laser\Always carry the laser as an additional weapon in Nix
index 180076f..e1d1825 100644 (file)
@@ -27,7 +27,7 @@
 \g_maplist_votable\Numero di mappe che sono mostrate nel voto delle mappe alla fine di una partita
 \sv_vote_simple_majority_factor\La semplice maggioranza vince il voto
 \XonoticMultiplayerDialog/Impostazioni avanzate...\Impostazioni avanzate del server
-\XonoticMultiplayerDialog/Mutatori...\Mutatori e arene dedicate ad armi
+\XonoticMultiplayerDialog/Mutatori...\Mutatori e arene di armi
 \g_dodging\Abilita schivamento
 \g_cloaked\Tutti i giocatori sono quasi invisibili
 \g_footsteps\Abilita suoni dei passi
@@ -40,7 +40,6 @@
 \g_pinata\I giocatori rilasceranno tutte le armi che possedevano appena vengono uccisi
 \g_weapon_stay\Le armi rimangono dopo che vengono raccolte
 \g_weaponarena\Selezionando un'arena dedicata ad un'arma si darà a tutti i giocatori quell'arma con munizioni infinite, e disabiliterà tutti gli altri raccoglimenti delle armi.
-\menu_weaponarena_with_laser\Abilita anche il laser nelle arene dedicate ad un'arma
 \g_minstagib\Ai giocatori sarà dato il Minstanex, che è un railgun con danni illimitati. Se il giocatore rimane senza munizioni, avrà 10 secondi per trovarne alcune, altrimenti morirà. Il fuoco secondario è un laser che non infligge nessun danno ed è buono per effettuare vari trickjump.
 \g_nix\"No items Xonotic" - invece di raccogliere oggetti, ognuno giocherà con la stessa arma. Dopo un pò di tempo, un conto alla rovescia inizierà, dopo il quale ognuno passerà ad un'altra arma.
 \g_nix_with_laser\Porta sempre il laser come arma aggiuntiva nella modalità "No items Xonotic"
index c575f1b..c9373f6 100644 (file)
@@ -11,3 +11,22 @@ set g_turrets_unit_fusreac_std_target_range_min 1
 set g_turrets_unit_fusreac_std_ammo_max 100
 set g_turrets_unit_fusreac_std_ammo 0
 set g_turrets_unit_fusreac_std_ammo_recharge 100
+
+set g_turrets_unit_fusreac_std_shot_radius 0
+set g_turrets_unit_fusreac_std_shot_spread 0
+set g_turrets_unit_fusreac_std_shot_force 0
+set g_turrets_unit_fusreac_std_shot_volly 0
+set g_turrets_unit_fusreac_std_shot_volly_refire 0
+set g_turrets_unit_fusreac_std_target_range_optimal 0
+set g_turrets_unit_fusreac_std_target_select_rangebias 0
+set g_turrets_unit_fusreac_std_target_select_samebias 0
+set g_turrets_unit_fusreac_std_target_select_anglebias 0
+set g_turrets_unit_fusreac_std_target_select_playerbias 0
+set g_turrets_unit_fusreac_std_aim_firetolerance_dist 0
+set g_turrets_unit_fusreac_std_aim_speed 0
+set g_turrets_unit_fusreac_std_aim_maxrot 0
+set g_turrets_unit_fusreac_std_aim_maxpitch 0
+set g_turrets_unit_fusreac_std_track_type 0
+set g_turrets_unit_fusreac_std_track_accel_pitch 0
+set g_turrets_unit_fusreac_std_track_accel_rot 0
+set g_turrets_unit_fusreac_std_track_blendrate 0
\ No newline at end of file