]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into martin-t/damagetext
authorMartin Taibr <taibr.martin@gmail.com>
Sun, 11 Sep 2016 01:07:41 +0000 (03:07 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Sun, 11 Sep 2016 01:07:41 +0000 (03:07 +0200)
27 files changed:
qcsrc/client/autocvars.qh
qcsrc/client/hud/hud.qc
qcsrc/client/hud/panel/chat.qc
qcsrc/client/hud/panel/modicons.qc
qcsrc/client/hud/panel/score.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/scoreboard.qh
qcsrc/client/view.qc
qcsrc/common/csqcmodel_settings.qh
qcsrc/common/minigames/cl_minigames.qh
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/minigames/minigame/snake.qc
qcsrc/common/mutators/mutator/damagetext/damagetext.qc
qcsrc/common/notifications/all.qh
qcsrc/common/physics/player.qh
qcsrc/common/viewloc.qc
qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.qc
qcsrc/menu/xonotic/gametypelist.qc
qcsrc/menu/xonotic/util.qc
qcsrc/menu/xonotic/util.qh
qcsrc/server/client.qc
qcsrc/server/command/cmd.qc
qcsrc/server/g_world.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_ca.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc

index 25ab0e2a053fcfe0ff45703a880a62f87d5724c3..9cbbcb5f7ee61f2207ed7a691ba88438397b9d80 100644 (file)
@@ -100,7 +100,6 @@ bool autocvar_cl_unpress_attack_on_weapon_switch = 1;
 bool autocvar_con_chat;
 bool autocvar_con_chatrect;
 float autocvar_con_chatsize;
-float autocvar_con_chattime;
 float autocvar_con_notify;
 float autocvar_con_notifysize;
 string autocvar_crosshair;
index 8ac6a4d991727ede9dbd1528eb5cb7c03667f2a5..c89fe08bc4f5f269298cf6c9d692ab2b8f8f2caa 100644 (file)
@@ -4,6 +4,7 @@
 #include "hud_config.qh"
 #include "../mapvoting.qh"
 #include "../teamradar.qh"
+#include <common/minigames/cl_minigames.qh>
 #include <common/t_items.qh>
 #include <common/deathtypes/all.qh>
 #include <common/items/_mod.qh>
@@ -409,8 +410,6 @@ void HUD_Vehicle()
        }
 }
 
-bool HUD_Minigame_Showpanels();
-
 void HUD_Panel_Draw(entity panent)
 {
        panel = panent;
@@ -425,7 +424,7 @@ void HUD_Panel_Draw(entity panent)
        }
 
        bool draw_allowed = false;
-       if (HUD_Minigame_Showpanels())
+       if (active_minigame && HUD_MinigameMenu_IsOpened())
        {
                if (panel.panel_showflags & PANEL_SHOW_MINIGAME)
                        draw_allowed = true;
index f3655e940107f101933d096b791a60239b1652f9..554f44e17ec759fa6da826b543672399405f8ee6 100644 (file)
@@ -77,17 +77,13 @@ void HUD_Chat()
 
        if(autocvar__hud_configure)
        {
-               vector chatsize;
-               chatsize = '1 1 0' * autocvar_con_chatsize;
+               vector chatsize = '1 1 0' * autocvar_con_chatsize;
                cvar_set("con_chatrect_x", "9001"); // over 9000, we'll fake it instead for more control over alpha and such
-               float i, a;
-               for(i = 0; i < autocvar_con_chat; ++i)
+               string str = textShortenToWidth(_("^3Player^7: This is the chat area."), mySize.x, chatsize, stringwidth_colors);
+               for(int i = 0; i < autocvar_con_chat; ++i)
                {
-                       if(i == autocvar_con_chat - 1)
-                               a = panel_fg_alpha;
-                       else
-                               a = panel_fg_alpha * floor(((i + 1) * 7 + autocvar_con_chattime)/45);
-                       drawcolorcodedstring(pos, textShortenToWidth(_("^3Player^7: This is the chat area."), mySize.x, chatsize, stringwidth_colors), chatsize, a, DRAWFLAG_NORMAL);
+                       // engine displays chat text at full alpha
+                       drawcolorcodedstring(pos, str, chatsize, 1, DRAWFLAG_NORMAL);
                        pos.y += chatsize.y;
                }
        }
index 2a12e81c25e140db54908ee2bc4710aabe7d2f5b..c3310b25a13b8189711c8ccecf7e3957b4b17c5c 100644 (file)
@@ -16,27 +16,11 @@ void DrawCAItem(vector myPos, vector mySize, float aspect_ratio, int layout, int
        vector color = '0 0 0';
        switch(i)
        {
-               case 0:
-                       stat = STAT(REDALIVE);
-                       pic = "player_red.tga";
-                       color = '1 0 0';
-                       break;
-               case 1:
-                       stat = STAT(BLUEALIVE);
-                       pic = "player_blue.tga";
-                       color = '0 0 1';
-                       break;
-               case 2:
-                       stat = STAT(YELLOWALIVE);
-                       pic = "player_yellow.tga";
-                       color = '1 1 0';
-                       break;
+               case 0: stat = STAT(REDALIVE); pic = "player_red"; color = '1 0 0'; break;
+               case 1: stat = STAT(BLUEALIVE); pic = "player_blue"; color = '0 0 1'; break;
+               case 2: stat = STAT(YELLOWALIVE); pic = "player_yellow"; color = '1 1 0'; break;
                default:
-               case 3:
-                       stat = STAT(PINKALIVE);
-                       pic = "player_pink.tga";
-                       color = '1 0 1';
-                       break;
+               case 3: stat = STAT(PINKALIVE); pic = "player_pink"; color = '1 0 1'; break;
        }
 
        if(mySize.x/mySize.y > aspect_ratio)
@@ -654,29 +638,15 @@ void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, int layout, in
        vector color = '0 0 0';
        switch(i)
        {
-               case 0:
-                       stat = STAT(DOM_PPS_RED);
-                       pic = "dom_icon_red";
-                       color = '1 0 0';
-                       break;
-               case 1:
-                       stat = STAT(DOM_PPS_BLUE);
-                       pic = "dom_icon_blue";
-                       color = '0 0 1';
-                       break;
-               case 2:
-                       stat = STAT(DOM_PPS_YELLOW);
-                       pic = "dom_icon_yellow";
-                       color = '1 1 0';
-                       break;
+               case 0: stat = STAT(DOM_PPS_RED); pic = "dom_icon_red"; color = '1 0 0'; break;
+               case 1: stat = STAT(DOM_PPS_BLUE); pic = "dom_icon_blue"; color = '0 0 1'; break;
+               case 2: stat = STAT(DOM_PPS_YELLOW); pic = "dom_icon_yellow"; color = '1 1 0'; break;
                default:
-               case 3:
-                       stat = STAT(DOM_PPS_PINK);
-                       pic = "dom_icon_pink";
-                       color = '1 0 1';
-                       break;
+               case 3: stat = STAT(DOM_PPS_PINK); pic = "dom_icon_pink"; color = '1 0 1'; break;
        }
-       float pps_ratio = stat / STAT(DOM_TOTAL_PPS);
+       float pps_ratio = 0;
+       if(STAT(DOM_TOTAL_PPS))
+               pps_ratio = stat / STAT(DOM_TOTAL_PPS);
 
        if(mySize.x/mySize.y > aspect_ratio)
        {
index 4b5df98d19892d237ba925b62f7439afd398eabe..f3d55a433e8db1792ddc098c8bd71e7f4b0186f8 100644 (file)
@@ -6,7 +6,6 @@
 
 // Score (#7)
 
-void Scoreboard_UpdatePlayerTeams();
 void HUD_Score_Rankings(vector pos, vector mySize, entity me)
 {
        float score;
index f82c7345ca0c7d3afdc84102cd5a728afa54c6ed..4e81d3789d317354b3cbe363cea2c669836be771 100644 (file)
@@ -141,12 +141,10 @@ void Scoreboard_UpdatePlayerTeams()
 {
        float Team;
        entity pl, tmp;
-       float num;
-
-       num = 0;
+       //int num = 0;
        for(pl = players.sort_next; pl; pl = pl.sort_next)
        {
-               num += 1;
+               //num += 1;
                Team = entcs_GetScoreTeam(pl.sv_entnum);
                if(SetTeam(pl, Team))
                {
@@ -366,8 +364,8 @@ void Cmd_Scoreboard_SetFields(int argc)
     TC(int, argc);
        int i, slash;
        string str, pattern;
-       float have_name = 0, have_primary = 0, have_secondary = 0, have_separator = 0;
-       float missing;
+       bool have_name = false, have_primary = false, have_secondary = false, have_separator = false;
+       int missing;
 
        if(!gametype)
                return; // do nothing, we don't know gametype and scores yet
@@ -470,9 +468,9 @@ LABEL(notfound)
 LABEL(found)
                                sbt_field[sbt_num_fields] = j;
                                if(j == ps_primary)
-                                       have_primary = 1;
+                                       have_primary = true;
                                if(j == ps_secondary)
-                                       have_secondary = 1;
+                                       have_secondary = true;
 
                        }
                }
@@ -482,11 +480,11 @@ LABEL(found)
        }
 
        if(scores_flags(ps_primary) & SFL_ALLOW_HIDE)
-               have_primary = 1;
+               have_primary = true;
        if(scores_flags(ps_secondary) & SFL_ALLOW_HIDE)
-               have_secondary = 1;
+               have_secondary = true;
        if(ps_primary == ps_secondary)
-               have_secondary = 1;
+               have_secondary = true;
        missing = (!have_primary) + (!have_secondary) + (!have_separator) + (!have_name);
 
        if(sbt_num_fields + missing < MAX_SBT_FIELDS)
@@ -953,22 +951,23 @@ vector Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_size)
        return end_pos;
 }
 
-float Scoreboard_WouldDraw() {
+bool Scoreboard_WouldDraw()
+{
        if (QuickMenu_IsOpened())
-               return 0;
+               return false;
        else if (HUD_Radar_Clickable())
-               return 0;
+               return false;
        else if (scoreboard_showscores)
-               return 1;
+               return true;
        else if (intermission == 1)
-               return 1;
+               return true;
        else if (intermission == 2)
-               return 0;
+               return false;
        else if (spectatee_status != -1 && STAT(HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS && !active_minigame)
-               return 1;
+               return true;
        else if (scoreboard_showscores_force)
-               return 1;
-       return 0;
+               return true;
+       return false;
 }
 
 float average_accuracy;
index 2c8c77dd6f2370d25a6fa85dbe8aefb9b0c5cbb7..a560b74c74ab616e33fc4ac497741a6e22cf4f48 100644 (file)
@@ -1,12 +1,13 @@
 #pragma once
 #include "../panel.qh"
 
-float scoreboard_active;
+bool scoreboard_active;
 float scoreboard_fade_alpha;
 
 void Cmd_Scoreboard_SetFields(float argc);
 void Scoreboard_Draw();
 void Scoreboard_InitScores();
+void Scoreboard_UpdatePlayerTeams();
 void Scoreboard_UpdatePlayerPos(entity pl);
 void Scoreboard_UpdateTeamPos(entity Team);
-float Scoreboard_WouldDraw();
+bool Scoreboard_WouldDraw();
index c375ccaa47c9aee3def6804eb33012935f1b9158..e5f8b6a580969ee76a0687fd19aee735a756afa1 100644 (file)
@@ -710,7 +710,6 @@ float TrueAimCheck()
 
 void PostInit();
 void CSQC_Demo_Camera();
-float Scoreboard_WouldDraw();
 float camera_mode;
 const float CAMERA_FREE = 1;
 const float CAMERA_CHASE = 2;
@@ -2249,7 +2248,7 @@ void CSQC_UpdateView(entity this, float w, float h)
 
        if(autocvar__hud_configure)
                HUD_Panel_Mouse();
-       else if ( HUD_MinigameMenu_IsOpened() || minigame_isactive() )
+       else if (HUD_MinigameMenu_IsOpened() || active_minigame)
                HUD_Minigame_Mouse();
        else if(QuickMenu_IsOpened())
                QuickMenu_Mouse();
index 9c8dd42917a9e85de2a97c863230273cacd26c2c..9c4909671e1408e5695fd572f7fbb6211de8c41e 100644 (file)
 # define TAG_VIEWLOC_NAME tag_networkviewloc
 # define TAG_VIEWLOC_TYPE int
 .float tag_networkviewloc;
-
-# define MOVETYPE_NAME move_movetype
 #else
 # define TAG_ENTITY_NAME tag_entity
 # define TAG_ENTITY_TYPE entity
 
 # define TAG_VIEWLOC_NAME viewloc
 # define TAG_VIEWLOC_TYPE entity
-
-# define MOVETYPE_NAME move_movetype
 #endif
 
 // new fields
@@ -67,7 +63,7 @@
        CSQCMODEL_PROPERTY(BIT(13), int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \
        CSQCMODEL_PROPERTY(BIT(14), TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) \
        CSQCMODEL_PROPERTY(BIT(15), int, ReadByte, WriteByte, multijump_count) \
-       CSQCMODEL_PROPERTY(BIT(16), int, ReadByte, WriteByte, MOVETYPE_NAME)
+       CSQCMODEL_PROPERTY(BIT(16), int, ReadByte, WriteByte, move_movetype)
 // TODO get rid of colormod/glowmod here; also get rid of some useless properties on non-players that only exist for CopyBody
 
 // add hook function calls here
index 602c7973585c1510e3903b4d6fe1d5d6d696ebaa..a0f6195d1232f6ec6ca994d4514de840b099c58a 100644 (file)
@@ -84,12 +84,6 @@ entity active_minigame;
 // minigame_player representing this client
 entity minigame_self;
 
-// Whethere there's an active minigame
-float minigame_isactive()
-{
-       return active_minigame != NULL;
-}
-
 // Execute a minigame command
 #define minigame_cmd(...) minigame_cmd_workaround(0,__VA_ARGS__)
 void minigame_cmd_workaround(float dummy, string...cmdargc);
@@ -100,7 +94,7 @@ void minigame_prompt();
 
 float HUD_MinigameMenu_IsOpened();
 void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger);
-float HUD_Minigame_Showpanels();
+
 // Adds a game-specific entry to the menu
 void HUD_MinigameMenu_CustomEntry(entity parent, string message, string event_arg);
 
index a359831dfdd3cb74535c790c34f71b5ba9723721..1a6d4ff52272e39e4204c9e892545e6688536f63 100644 (file)
@@ -575,7 +575,7 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary
        {
                mousepos_x = nPrimary;
                mousepos_y = nSecondary;
-               if ( minigame_isactive() && HUD_mouse_over(HUD_PANEL(MINIGAME_BOARD)) )
+               if ( active_minigame && HUD_mouse_over(HUD_PANEL(MINIGAME_BOARD)) )
                        active_minigame.minigame_event(active_minigame,"mouse_moved",mousepos);
                return true;
 
@@ -607,7 +607,7 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary
                                return false;
                }
 
-               if ( minigame_isactive() && ( bInputType == 0 || bInputType == 1 ) )
+               if ( active_minigame && ( bInputType == 0 || bInputType == 1 ) )
                {
                        string device = "";
                        string action = bInputType == 0 ? "pressed" : "released";
@@ -690,8 +690,3 @@ void HUD_Minigame_Mouse()
 
        draw_cursor_normal(mousepos, '1 1 1', panel_fg_alpha);
 }
-
-bool HUD_Minigame_Showpanels()
-{
-       return (HUD_MinigameMenu_IsOpened() && minigame_isactive());
-}
index cd45ed96d6662cada5cdf4d9f669ded4a4e1e61d..c15ecd463b94f4e8da29e7e745fd5bc87fef3de7 100644 (file)
@@ -675,16 +675,15 @@ void snake_hud_board(vector pos, vector mySize)
 void snake_hud_status(vector pos, vector mySize)
 {
        HUD_Panel_DrawBg();
-       vector ts;
-       ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message,
+       vector ts = minigame_drawstring_wrapped(mySize.x, pos, active_minigame.descriptor.message,
                hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5);
-       ts_y += hud_fontsize_y;
-       pos_y += ts_y;
-       mySize_y -= ts_y;
+       ts.y += hud_fontsize.y;
+       pos.y += ts.y;
+       mySize.y -= ts.y;
 
        vector player_fontsize = hud_fontsize * 1.75;
-       ts_y = ( mySize_y - SNAKE_TEAMS*player_fontsize_y ) / SNAKE_TEAMS;
-       ts_x = mySize_x;
+       ts.y = player_fontsize.y + (mySize.y - SNAKE_TEAMS * player_fontsize.y) / SNAKE_TEAMS;
+       ts.x = mySize_x;
        vector mypos;
 
        entity e;
@@ -692,22 +691,26 @@ void snake_hud_status(vector pos, vector mySize)
        {
                if ( e.classname == "minigame_player" )
                {
-                       mypos = pos;
-                       mypos_y  += (e.team-1) * (player_fontsize_y + ts_y);
+                       mypos = pos + eY * (e.team - 1) * ts.y;
 
-                       drawfill(mypos, ts, snake_teamcolor(e.team), 0.25, DRAWFLAG_ADDITIVE);
+                       if (e == minigame_self)
+                       {
+                               const vector hl_size = '1 1 0';
+                               drawfill(mypos + hl_size, ts - 2 * hl_size, snake_teamcolor(e.team), 0.25 * panel_fg_alpha, DRAWFLAG_ADDITIVE);
+                               drawborderlines(hl_size.x, mypos + hl_size, ts - 2 * hl_size, snake_teamcolor(e.team), panel_fg_alpha, DRAWFLAG_NORMAL);
+                       }
+                       else
+                               drawfill(mypos, ts, snake_teamcolor(e.team), 0.25 * panel_fg_alpha, DRAWFLAG_ADDITIVE);
 
-                       minigame_drawcolorcodedstring_trunc(mySize_x,mypos,
-                               entcs_GetName(e.minigame_playerslot-1),
+                       minigame_drawcolorcodedstring_trunc(mySize.x - hud_fontsize.x * 0.5, mypos + eX * hud_fontsize.x * 0.25,
+                               entcs_GetName(e.minigame_playerslot - 1),
                                player_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
 
-                       drawstring(mypos+eY*player_fontsize_y,ftos(e.snake_score),'48 48 0' * (SNAKE_TEAMS * 0.1),
-                                          '0.7 0.84 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-                       drawstring(mypos+(eY*player_fontsize_y) + (eX*player_fontsize_x),strcat("1UP: ", ftos(active_minigame.snake_lives[e.team])),'48 48 0' * (SNAKE_TEAMS * 0.1),
-                                                        '1 0.44 0.54', panel_fg_alpha, DRAWFLAG_NORMAL);
-
-                       if ( e == minigame_self )
-                               drawborderlines(1, mypos, ts, snake_teamcolor(e.team), 1, DRAWFLAG_NORMAL);
+                       mypos.y += player_fontsize.y;
+                       drawstring_aspect(mypos, ftos(e.snake_score), ts - eY * player_fontsize.y - eX * ts.x * (3 / 4),
+                                                               '0.7 0.84 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawstring_aspect(mypos + eX * ts.x * (1 / 4), strcat("1UP: ", ftos(active_minigame.snake_lives[e.team])), ts - eY * player_fontsize.y - eX * ts.x * (1 / 4),
+                                                               '1 0.44 0.54', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
        }
 }
index 9622630e183bc112e5ed4fa2cfdb82edabf8b57b..fb60cda27eaf2015b6c62074eb064e012f507753 100644 (file)
@@ -206,7 +206,7 @@ CLASS(XonoticDamageTextSettings, XonoticTab)
             this.TD(this, 1, 3, e = makeXonoticCheckBox(0, "cl_damagetext_friendlyfire", _("Draw damage numbers for friendly fire")));
                 setDependent(e, "cl_damagetext", 1, 1);
         this.TR(this);
-            this.TD(this, 1, 1, e = makeXonoticTextLabel(0, _("Color (Friendly Fire):")));
+            this.TD(this, 1, 1, e = makeXonoticTextLabel(0, _("Color:")));
                 setDependentAND(e, "cl_damagetext", 1, 1, "cl_damagetext_friendlyfire", 1, 1);
             this.TD(this, 2, 2, e = makeXonoticColorpickerString("cl_damagetext_friendlyfire_color", "cl_damagetext_friendlyfire_color"));
                 setDependentAND(e, "cl_damagetext", 1, 1, "cl_damagetext_friendlyfire", 1, 1);
index ccdcc690a8148cbc5308221823587225311af3c8..2a1eb458f4a8a4cef20746a2cd04a9ebb313c635 100644 (file)
@@ -75,8 +75,7 @@ USING(Notification, entity);
 
 // used for notification system multi-team identifiers
 #define APP_TEAM_NUM(num, prefix) ((num == NUM_TEAM_1) ? prefix##_RED : ((num == NUM_TEAM_2) ? prefix##_BLUE : ((num == NUM_TEAM_3) ? prefix##_YELLOW : prefix##_PINK)))
-/** @deprecated use APP_TEAM_NUM */
-#define APP_TEAM_ENT(ent, prefix) APP_TEAM_NUM(ent.team, prefix)
+#define APP_NUM(num, prefix) ((num) ? APP_TEAM_NUM(num, prefix) : prefix##_NEUTRAL)
 
 #define EIGHT_VARS_TO_VARARGS_VARLIST \
        VARITEM(1, 0, s1) \
index 9e7b799d027257e72d1201f6f013fcbffe57eb99..fb7edc83a3b571e4820cd4304e0bb8fcc3973dc8 100644 (file)
@@ -184,9 +184,9 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK)
        .entity hook;
 
 // TODO
-       #define IS_CLIENT(s)                        ((s).isplayermodel)
+       #define IS_CLIENT(s)                        ((s).isplayermodel || (s) == csqcplayer)
        #define IS_PLAYER(s)                        ((s).isplayermodel)
-       #define IS_NOT_A_CLIENT(s)                  (!(s).isplayermodel)
+       #define IS_NOT_A_CLIENT(s)                  (!(s).isplayermodel && (s) != csqcplayer)
        #define isPushable(s)                       ((s).isplayermodel || (s).pushable || ((s).flags & FL_PROJECTILE))
 
        //float player_multijump;
index 7d6a3818e0ee8fd5024587e37107569a92db7306..300aed4fc7f99a36b1367a90e09a991cbb2fc6b9 100644 (file)
@@ -75,6 +75,10 @@ void viewloc_SetTags(entity this)
 }
 
 vector old_camera_angle = '0 0 0';
+bool autocvar_cam_snap_close;
+bool autocvar_cam_track;
+bool autocvar_cam_snap_hard;
+bool autocvar_cam_snap_unlock;
 void viewloc_SetViewLocation()
 {
        entity view = CSQCModel_server2csqc(player_localentnum - 1);
@@ -82,7 +86,7 @@ void viewloc_SetViewLocation()
        //NOTE: the "cam_" cvars sould probably be changed out with a spawnflag or an entity key. I have it like this for my testing -- Player_2
        if(view.viewloc && !wasfreed(view.viewloc) && view.viewloc.enemy && view.viewloc.goalentity)
        {
-               vector position_a, position_b, camera_position, camera_angle, forward, backward;
+               vector position_a, position_b, camera_position, camera_angle = '0 0 0', forward, backward;
                //vector scratch;
 
                position_a = view.viewloc.enemy.origin;
@@ -100,20 +104,18 @@ void viewloc_SetViewLocation()
                        camera_position = vec_bounds_in(view.origin, position_a, position_b);
 
 
-               camera_angle = '0 0 0';
-
                // a tracking camera follows the player when it leaves the world box
-               if (cvar("cam_track")) {
+               if (autocvar_cam_track) {
                        camera_angle = aim_vec (camera_position, view.origin);
                }
 
                // hard snap changes the angle as soon as it crosses over the nearest 90 degree mark
-               if (cvar("cam_snap_hard")){
+               if (autocvar_cam_snap_hard){
                        camera_angle = angle_snap_vec(aim_vec(camera_position, view.origin), 90);
                }
 
                // tries to avoid snapping unless it *really* needs to
-               if (cvar("cam_snap_close")){
+               if (autocvar_cam_snap_close){
 
                        // like hard snap, but don't snap angles yet.
                        camera_angle = aim_vec(camera_position, view.origin);
@@ -131,7 +133,7 @@ void viewloc_SetViewLocation()
                }
 
                //unlocking this allows the camera to look up and down. this also allows a top-down view.
-               if (!cvar("cam_snap_unlock")) {
+               if (!autocvar_cam_snap_unlock) {
                        camera_angle_x = 0;
                        camera_angle_z = 0;
                }
index 8fcb975eab6764c5b43d44061102d4ff0132b7b3..2f2ab901a84239a9c37c21866552b449f7089ed6 100644 (file)
@@ -35,7 +35,7 @@ void XonoticMapInfoDialog_loadMapInfo(entity me, int i, entity mlb)
        else
                me.previewImage.src = me.currentMapPreviewImage;
 
-       for(i = 0; i < GameType_GetCount(); ++i)
+       for(i = 0; i < GameType_GetTotalCount(); ++i)
        {
                entity e;
                e = me.(typeLabels[i]);
@@ -69,9 +69,9 @@ void XonoticMapInfoDialog_fill(entity me)
        me.TR(me);
                me.TD(me, 1, w, e = makeXonoticTextLabel(0, _("Game types:")));
 
-       n = ceil(GameType_GetCount() / (me.rows - 6));
+       n = ceil(GameType_GetTotalCount() / (me.rows - 6));
        wgt = (w - 0.2) / n;
-       for(i = 0; i < GameType_GetCount(); ++i)
+       for(i = 0; i < GameType_GetTotalCount(); ++i)
        {
                if(mod(i, n) == 0)
                {
index 254f1c0012563edf052503b74a6a7cc819c75dc9..a08e4dbbc5fa13dc4eb51680a1bb551a25780fc0 100644 (file)
@@ -17,7 +17,7 @@ void XonoticGametypeList_configureXonoticGametypeList(entity me)
 
        if(SKINBOOL_GAMETYPELIST_ICON_BLUR)
        {
-               for(int i = 0; i < GameType_GetCount(); ++i)
+               for(int i = 0; i < GameType_GetTotalCount(); ++i)
                        draw_PreloadPictureWithFlags(GameType_GetIcon(i), PRECACHE_PIC_MIPMAP);
        }
 
index ec76d389e6cd8d9206162aa7645dc8527a8ab3b8..e746bd725746a2a93a6e84812e8810b3cf74deac 100644 (file)
@@ -685,16 +685,21 @@ float updateCompression()
        GAMETYPE(MAPINFO_TYPE_NEXBALL) \
        GAMETYPE(MAPINFO_TYPE_ONSLAUGHT) \
        GAMETYPE(MAPINFO_TYPE_ASSAULT) \
-       if (cvar("developer")) GAMETYPE(MAPINFO_TYPE_RACE) \
-       if (cvar("developer")) GAMETYPE(MAPINFO_TYPE_CTS) \
        /* GAMETYPE(MAPINFO_TYPE_INVASION) */ \
        /**/
 
+// hidden gametypes come last so indexing always works correctly
+#define HIDDEN_GAMETYPES \
+       GAMETYPE(MAPINFO_TYPE_RACE) \
+       GAMETYPE(MAPINFO_TYPE_CTS) \
+       /**/
+
 Gametype GameType_GetID(int cnt)
 {
        int i = 0;
        #define GAMETYPE(it) { if (i++ == cnt) return it; }
        GAMETYPES
+       HIDDEN_GAMETYPES
        #undef GAMETYPE
        return NULL;
 }
@@ -705,6 +710,19 @@ int GameType_GetCount()
        #define GAMETYPE(id) ++i;
        GAMETYPES
        #undef GAMETYPE
+       #define GAMETYPE(it) if (cvar("developer")) ++i;
+       HIDDEN_GAMETYPES
+       #undef GAMETYPE
+       return i;
+}
+
+int GameType_GetTotalCount()
+{
+       int i = 0;
+       #define GAMETYPE(id) ++i;
+       GAMETYPES
+       HIDDEN_GAMETYPES
+       #undef GAMETYPE
        return i;
 }
 
index c7e7c0cd70b96d138e8f7c09fdf70a7d61693343..96fef2ad4006f553a3bd8a5b22dd594b684df5c3 100644 (file)
@@ -34,6 +34,7 @@ string GameType_GetName(int cnt);
 string GameType_GetIcon(int cnt);
 //string GameType_GetTeams(float cnt);
 int GameType_GetCount();
+int GameType_GetTotalCount();
 
 void dialog_hudpanel_common_notoggle(entity me, string panelname);
 #define DIALOG_HUDPANEL_COMMON_NOTOGGLE() \
index f71afe7f3bde07892f28e0de9e8fa3b17f536aee..dd9aab7fabc0c55c29c85680c2e32cc24f9ee434 100644 (file)
@@ -1142,7 +1142,10 @@ void ClientConnect(entity this)
 
        this.netname_previous = strzone(this.netname);
 
-       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && IS_PLAYER(this)) ? APP_TEAM_ENT(this, INFO_JOIN_CONNECT_TEAM) : INFO_JOIN_CONNECT), this.netname);
+       if(teamplay && IS_PLAYER(this))
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_JOIN_CONNECT_TEAM), this.netname);
+       else
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_JOIN_CONNECT, this.netname);
 
        stuffcmd(this, clientstuff, "\n");
        stuffcmd(this, "cl_particles_reloadeffects\n"); // TODO do we still need this?
@@ -1703,7 +1706,7 @@ void SpectateCopy(entity this, entity spectatee)
 bool SpectateUpdate(entity this)
 {
        if(!this.enemy)
-           return false;
+               return false;
 
        if(!IS_PLAYER(this.enemy) || this == this.enemy)
        {
@@ -1866,40 +1869,34 @@ void ShowRespawnCountdown(entity this)
        }
 }
 
-.float caplayer;
-
-void LeaveSpectatorMode(entity this)
+.bool team_selected;
+bool ShowTeamSelection(entity this)
 {
-       if(this.caplayer)
-               return;
-       if(nJoinAllowed(this, this))
-       {
-               if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
-               {
-                       TRANSMUTE(Player, this);
-
-                       SetSpectatee(this, NULL);
+       if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || this.team_selected || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
+               return false;
+       stuffcmd(this, "menu_showteamselect\n");
+       return true;
+}
+void Join(entity this)
+{
+       TRANSMUTE(Player, this);
 
-                       if(autocvar_g_campaign || autocvar_g_balance_teams)
-                               { JoinBestTeam(this, false, true); }
+       if(!this.team_selected)
+       if(autocvar_g_campaign || autocvar_g_balance_teams)
+               JoinBestTeam(this, false, true);
 
-                       if(autocvar_g_campaign)
-                               { campaign_bots_may_start = true; }
+       if(autocvar_g_campaign)
+               campaign_bots_may_start = true;
 
-                       Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN);
+       Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN);
 
-                       PutClientInServer(this);
+       PutClientInServer(this);
 
-                       if(IS_PLAYER(this)) { Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); }
-               }
-               else
-                       stuffcmd(this, "menu_showteamselect\n");
-       }
+       if(teamplay && this.team != -1)
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_JOIN_PLAY_TEAM), this.netname);
        else
-       {
-               // Player may not join because g_maxplayers is set
-               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT);
-       }
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_JOIN_PLAY, this.netname);
+       this.team_selected = false;
 }
 
 /**
@@ -1908,20 +1905,20 @@ void LeaveSpectatorMode(entity this)
  * it checks whether the number of currently playing players exceeds g_maxplayers.
  * @return int number of free slots for players, 0 if none
  */
-bool nJoinAllowed(entity this, entity ignore)
+int nJoinAllowed(entity this, entity ignore)
 {
        if(!ignore)
        // this is called that way when checking if anyone may be able to join (to build qcstatus)
        // so report 0 free slots if restricted
        {
                if(autocvar_g_forced_team_otherwise == "spectate")
-                       return false;
+                       return 0;
                if(autocvar_g_forced_team_otherwise == "spectator")
-                       return false;
+                       return 0;
        }
 
-       if(this.team_forced < 0)
-               return false; // forced spectators can never join
+       if(this && this.team_forced < 0)
+               return 0; // forced spectators can never join
 
        // TODO simplify this
        int totalClients = 0;
@@ -1934,13 +1931,20 @@ bool nJoinAllowed(entity this, entity ignore)
                        ++currentlyPlaying;
        ));
 
+       float free_slots = 0;
        if (!autocvar_g_maxplayers)
-               return maxclients - totalClients;
+               free_slots = maxclients - totalClients;
+       else if(currentlyPlaying < autocvar_g_maxplayers)
+               free_slots = min(maxclients - totalClients, autocvar_g_maxplayers - currentlyPlaying);
 
-       if(currentlyPlaying < autocvar_g_maxplayers)
-               return min(maxclients - totalClients, autocvar_g_maxplayers - currentlyPlaying);
+       static float join_prevent_msg_time = 0;
+       if(this && ignore && !free_slots && time > join_prevent_msg_time)
+       {
+               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT);
+               join_prevent_msg_time = time + 3;
+       }
 
-       return false;
+       return free_slots;
 }
 
 /**
@@ -2007,6 +2011,16 @@ void PrintWelcomeMessage(entity this)
        }
 }
 
+bool joinAllowed(entity this)
+{
+       if (this.version_mismatch) return false;
+       if (!nJoinAllowed(this, this)) return false;
+       if (teamplay && lockteams) return false;
+       if (ShowTeamSelection(this)) return false;
+       if (MUTATOR_CALLHOOK(ForbidSpawn, this)) return false;
+       return true;
+}
+
 void ObserverThink(entity this)
 {
        if ( this.impulse )
@@ -2014,8 +2028,9 @@ void ObserverThink(entity this)
                MinigameImpulse(this, this.impulse);
                this.impulse = 0;
        }
+
        if (this.flags & FL_JUMPRELEASED) {
-               if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+               if (PHYS_INPUT_BUTTON_JUMP(this) && joinAllowed(this)) {
                        this.flags &= ~FL_JUMPRELEASED;
                        this.flags |= FL_SPAWNING;
                } else if(PHYS_INPUT_BUTTON_ATCK(this) && !this.version_mismatch) {
@@ -2033,7 +2048,7 @@ void ObserverThink(entity this)
                        if(this.flags & FL_SPAWNING)
                        {
                                this.flags &= ~FL_SPAWNING;
-                               LeaveSpectatorMode(this);
+                               Join(this);
                                return;
                        }
                }
@@ -2054,8 +2069,9 @@ void SpectatorThink(entity this)
                        return;
                }
        }
+
        if (this.flags & FL_JUMPRELEASED) {
-               if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+               if (PHYS_INPUT_BUTTON_JUMP(this) && joinAllowed(this)) {
                        this.flags &= ~FL_JUMPRELEASED;
                        this.flags |= FL_SPAWNING;
                } else if(PHYS_INPUT_BUTTON_ATCK(this) || this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) {
@@ -2090,7 +2106,7 @@ void SpectatorThink(entity this)
                        if(this.flags & FL_SPAWNING)
                        {
                                this.flags &= ~FL_SPAWNING;
-                               LeaveSpectatorMode(this);
+                               Join(this);
                                return;
                        }
                }
index ce6592408cb4a3fa50af5cf90d0a19eee5271f4a..ea9610b16073048fc10fd73ac97a09e1147c8065 100644 (file)
@@ -159,33 +159,19 @@ void ClientCommand_mv_getpicture(entity caller, float request, float argc)  // i
        }
 }
 
+bool joinAllowed(entity this);
+void Join(entity this);
 void ClientCommand_join(entity caller, float request)
 {
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if (IS_CLIENT(caller))
-                       {
-                               if (!IS_PLAYER(caller) && !lockteams && !gameover)
-                               {
-                                       if (caller.caplayer) return;
-                                       if (nJoinAllowed(caller, caller))
-                                       {
-                                               if (autocvar_g_campaign)   campaign_bots_may_start = true;
-                                               TRANSMUTE(Player, caller);
-                                               PlayerScore_Clear(caller);
-                                               Kill_Notification(NOTIF_ONE_ONLY, caller, MSG_CENTER, CPID_PREVENT_JOIN);
-                                               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && caller.team != -1) ? APP_TEAM_ENT(caller, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), caller.netname);
-                                               PutClientInServer(caller);
-                                       }
-                                       else
-                                       {
-                                               // player may not join because of g_maxplayers is set
-                                               Send_Notification(NOTIF_ONE_ONLY, caller, MSG_CENTER, CENTER_JOIN_PREVENT);
-                                       }
-                               }
-                       }
+                       if (!gameover)
+                       if (IS_CLIENT(caller) && !IS_PLAYER(caller))
+                       if (joinAllowed(caller))
+                               Join(caller);
+
                        return;  // never fall through to usage
                }
 
@@ -326,6 +312,7 @@ void ClientCommand_say_team(entity caller, float request, float argc, string com
        }
 }
 
+.bool team_selected;
 void ClientCommand_selectteam(entity caller, float request, float argc)
 {
        switch (request)
@@ -363,7 +350,7 @@ void ClientCommand_selectteam(entity caller, float request, float argc)
 
                                                                if (selection)
                                                                {
-                                                                       if (caller.team == selection && !IS_DEAD(caller))
+                                                                       if (caller.team == selection && selection != -1 && !IS_DEAD(caller))
                                                                        {
                                                                                sprint(caller, "^7You already are on that team.\n");
                                                                        }
@@ -385,6 +372,8 @@ void ClientCommand_selectteam(entity caller, float request, float argc)
                                                                                }
                                                                                ClientKill_TeamChange(caller, selection);
                                                                        }
+                                                                       if(!IS_PLAYER(caller))
+                                                                               caller.team_selected = true; // avoids asking again for team selection on join
                                                                }
                                                        }
                                                        else
@@ -488,9 +477,11 @@ void ClientCommand_spectate(entity caller, float request)
 
                                if (mutator_returnvalue == MUT_SPECCMD_RETURN) return;
 
-                               if ((IS_PLAYER(caller) || mutator_returnvalue == MUT_SPECCMD_FORCE) && autocvar_sv_spectate == 1) ClientKill_TeamChange(caller, -2); // observe
+                               if ((IS_PLAYER(caller) || mutator_returnvalue == MUT_SPECCMD_FORCE))
+                               if (autocvar_sv_spectate == 1)
+                                       ClientKill_TeamChange(caller, -2); // observe
                        }
-                       return;                                                                                                                        // never fall through to usage
+                       return; // never fall through to usage
                }
 
                default:
index e3bc706979607a7aa99c1e7a6203027cd67dd417..fe7822bc161549c5ab9f45a93eb5b61d6df24aad 100644 (file)
@@ -56,9 +56,9 @@ void PingPLReport_Think(entity this)
        {
                WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
                WriteByte(MSG_BROADCAST, this.cnt);
-               WriteShort(MSG_BROADCAST, max(1, e.ping));
-               WriteByte(MSG_BROADCAST, ceil(e.ping_packetloss * 255));
-               WriteByte(MSG_BROADCAST, ceil(e.ping_movementloss * 255));
+               WriteShort(MSG_BROADCAST, bound(1, e.ping, 65535));
+               WriteByte(MSG_BROADCAST, min(ceil(e.ping_packetloss * 255), 255));
+               WriteByte(MSG_BROADCAST, min(ceil(e.ping_movementloss * 255), 255));
 
                // record latency times for clients throughout the match so we can report it to playerstats
                if(time > (e.latency_time + LATENCY_THINKRATE))
index af7e60c4c01f4371ad33347715cd1bc2766c653c..88151a54640a897af32ee8db71697401f789c821 100644 (file)
@@ -16,6 +16,14 @@ MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
     /**/
 MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
 
+/**
+ * return true to prevent a spectator/observer to spawn as player
+ */
+ #define EV_ForbidSpawn(i, o) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+    /**/
+MUTATOR_HOOKABLE(ForbidSpawn, EV_ForbidSpawn);
+
 /** called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here) */
 #define EV_PlayerSpawn(i, o) \
        /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
index 75c9d600849934b9c2af6c408edea4fb35e63354..84f668bab5f9954db2cb331a8adef632fa894746 100644 (file)
@@ -166,6 +166,18 @@ MUTATOR_HOOKFUNCTION(ca, PlayerSpawn)
                eliminatedPlayers.SendFlags |= 1;
 }
 
+MUTATOR_HOOKFUNCTION(ca, ForbidSpawn)
+{
+       entity player = M_ARGV(0, entity);
+
+       // spectators / observers that weren't playing can join; they are
+       // immediately forced to observe in the PutClientInServer hook
+       // this way they are put in a team and can play in the next round
+       if (!allowed_to_spawn && player.caplayer)
+               return true;
+       return false;
+}
+
 MUTATOR_HOOKFUNCTION(ca, PutClientInServer)
 {
        entity player = M_ARGV(0, entity);
@@ -265,25 +277,20 @@ MUTATOR_HOOKFUNCTION(ca, ClientDisconnect)
        return true;
 }
 
-MUTATOR_HOOKFUNCTION(ca, ForbidPlayerScore_Clear)
-{
-       return true;
-}
-
 MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver)
 {
     entity player = M_ARGV(0, entity);
 
        if (!IS_DEAD(player))
                ca_LastPlayerForTeam_Notify(player);
-       if (player.killindicator_teamchange == -2)
+       if (player.killindicator_teamchange == -2) // player wants to spectate
                player.caplayer = 0;
        if (player.caplayer)
                player.frags = FRAGS_LMS_LOSER;
-    else
-        player.frags = FRAGS_SPECTATOR;
        if (!warmup_stage)
                eliminatedPlayers.SendFlags |= 1;
+       if (!player.caplayer)
+               return false;  // allow team reset
        return true;  // prevent team reset
 }
 
index 79ac9994625de1b4a1f05da3ad540dee3d75d876..56ee04d5dafe61135f3c2acc1fb6b6bed70fd5ac 100644 (file)
@@ -135,10 +135,14 @@ void ctf_CaptureRecord(entity flag, entity player)
        string refername = db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"));
 
        // notify about shit
-       if(ctf_oneflag) { Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_CTF_CAPTURE_NEUTRAL, player.netname); }
-       else if(!ctf_captimerecord) { Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_ENT(flag, CHOICE_CTF_CAPTURE_TIME), player.netname, (cap_time * 100)); }
-       else if(cap_time < cap_record) { Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_ENT(flag, CHOICE_CTF_CAPTURE_BROKEN), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
-       else { Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_ENT(flag, CHOICE_CTF_CAPTURE_UNBROKEN), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
+       if(ctf_oneflag)
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_CTF_CAPTURE_NEUTRAL, player.netname);
+       else if(!ctf_captimerecord)
+               Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_TIME), player.netname, (cap_time * 100));
+       else if(cap_time < cap_record)
+               Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_BROKEN), player.netname, refername, (cap_time * 100), (cap_record * 100));
+       else
+               Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_UNBROKEN), player.netname, refername, (cap_time * 100), (cap_record * 100));
 
        // write that shit in the database
        if(!ctf_oneflag) // but not in 1-flag mode
@@ -363,7 +367,7 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype)
        flag.ctf_status = FLAG_DROPPED;
 
        // messages and sounds
-       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_LOST) : INFO_CTF_LOST_NEUTRAL), player.netname);
+       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_LOST), player.netname);
        _sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTEN_NONE);
        ctf_EventLog("dropped", player.team, player);
 
@@ -425,11 +429,11 @@ void ctf_Handle_Retrieve(entity flag, entity player)
 
        FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
                if(it == sender)
-                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((flag.team) ? APP_TEAM_ENT(flag, CENTER_CTF_PASS_SENT) : CENTER_CTF_PASS_SENT_NEUTRAL), player.netname);
+                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_SENT), player.netname);
                else if(it == player)
-                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((flag.team) ? APP_TEAM_ENT(flag, CENTER_CTF_PASS_RECEIVED) : CENTER_CTF_PASS_RECEIVED_NEUTRAL), sender.netname);
+                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_RECEIVED), sender.netname);
                else if(SAME_TEAM(it, sender))
-                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((flag.team) ? APP_TEAM_ENT(flag, CENTER_CTF_PASS_OTHER) : CENTER_CTF_PASS_OTHER_NEUTRAL), sender.netname, player.netname);
+                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_OTHER), sender.netname, player.netname);
        ));
 
        // create new waypoint
@@ -566,7 +570,7 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype)
        player.throw_count = 0;
 
        // messages and sounds
-       Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((enemy_flag.team) ? APP_TEAM_ENT(enemy_flag, CENTER_CTF_CAPTURE) : CENTER_CTF_CAPTURE_NEUTRAL));
+       Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_NUM(enemy_flag.team, CENTER_CTF_CAPTURE));
        ctf_CaptureRecord(enemy_flag, player);
        _sound(player, CH_TRIGGER, ((ctf_oneflag) ? player_team_flag.snd_flag_capture : ((DIFF_TEAM(player, flag)) ? enemy_flag.snd_flag_capture : flag.snd_flag_capture)), VOL_BASE, ATTEN_NONE);
 
@@ -610,12 +614,12 @@ void ctf_Handle_Return(entity flag, entity player)
        // messages and sounds
        if(IS_MONSTER(player))
        {
-               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_ENT(flag, INFO_CTF_RETURN_MONSTER), player.monster_name);
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(flag.team, INFO_CTF_RETURN_MONSTER), player.monster_name);
        }
        else if(flag.team)
        {
-               Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT(flag, CENTER_CTF_RETURN));
-               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_ENT(flag, INFO_CTF_RETURN), player.netname);
+               Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_NUM(flag.team, CENTER_CTF_RETURN));
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(flag.team, INFO_CTF_RETURN), player.netname);
        }
        _sound(player, CH_TRIGGER, flag.snd_flag_returned, VOL_BASE, ATTEN_NONE);
        ctf_EventLog("return", flag.team, player);
@@ -681,13 +685,17 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
        }
 
        // messages and sounds
-       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_PICKUP) : INFO_CTF_PICKUP_NEUTRAL), player.netname);
-       if(ctf_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER); }
-       if(!flag.team) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PICKUP_NEUTRAL); }
-       else if(CTF_DIFFTEAM(player, flag)) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT(flag, CENTER_CTF_PICKUP)); }
-       else { Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((SAME_TEAM(player, flag)) ? CENTER_CTF_PICKUP_TEAM : CENTER_CTF_PICKUP_TEAM_ENEMY), Team_ColorCode(flag.team)); }
+       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_PICKUP), player.netname);
+       if(ctf_stalemate)
+               Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER);
+       if(!flag.team)
+               Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PICKUP_NEUTRAL);
+       else if(CTF_DIFFTEAM(player, flag))
+               Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_NUM(flag.team, CENTER_CTF_PICKUP));
+       else
+               Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((SAME_TEAM(player, flag)) ? CENTER_CTF_PICKUP_TEAM : CENTER_CTF_PICKUP_TEAM_ENEMY), Team_ColorCode(flag.team));
 
-       Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, ((flag.team) ? APP_TEAM_ENT(flag, CHOICE_CTF_PICKUP_TEAM) : CHOICE_CTF_PICKUP_TEAM_NEUTRAL), Team_ColorCode(player.team), player.netname);
+       Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, APP_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
 
        if(!flag.team)
                FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname)));
@@ -696,7 +704,7 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
                FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
                        if(CTF_SAMETEAM(flag, it))
                        if(SAME_TEAM(player, it))
-                               Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_ENT(flag, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
+                               Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
                        else
                                Send_Notification(NOTIF_ONE, it, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), player.netname);
                ));
@@ -760,14 +768,17 @@ void ctf_CheckFlagReturn(entity flag, int returntype)
                {
                        switch(returntype)
                        {
-                               case RETURN_DROPPED: Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_FLAGRETURN_DROPPED) : INFO_CTF_FLAGRETURN_DROPPED_NEUTRAL)); break;
-                               case RETURN_DAMAGE: Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_FLAGRETURN_DAMAGED) : INFO_CTF_FLAGRETURN_DAMAGED_NEUTRAL)); break;
-                               case RETURN_SPEEDRUN: Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_FLAGRETURN_SPEEDRUN) : INFO_CTF_FLAGRETURN_SPEEDRUN_NEUTRAL), ctf_captimerecord); break;
-                               case RETURN_NEEDKILL: Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_FLAGRETURN_NEEDKILL) : INFO_CTF_FLAGRETURN_NEEDKILL_NEUTRAL)); break;
-
+                               case RETURN_DROPPED:
+                                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_DROPPED)); break;
+                               case RETURN_DAMAGE:
+                                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_DAMAGED)); break;
+                               case RETURN_SPEEDRUN:
+                                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_SPEEDRUN), ctf_captimerecord); break;
+                               case RETURN_NEEDKILL:
+                                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_NEEDKILL)); break;
                                default:
                                case RETURN_TIMEOUT:
-                                       { Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_FLAGRETURN_TIMEOUT) : INFO_CTF_FLAGRETURN_TIMEOUT_NEUTRAL)); break; }
+                                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_TIMEOUT)); break;
                        }
                        _sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTEN_NONE);
                        ctf_EventLog("returned", flag.team, NULL);
@@ -2312,7 +2323,7 @@ MUTATOR_HOOKFUNCTION(ctf, AbortSpeedrun)
 
        if(player.flagcarried)
        {
-               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((player.flagcarried.team) ? APP_TEAM_ENT(player.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN) : INFO_CTF_FLAGRETURN_ABORTRUN_NEUTRAL));
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(player.flagcarried.team, INFO_CTF_FLAGRETURN_ABORTRUN));
                ctf_RespawnFlag(player.flagcarried);
                return true;
        }
index 0e5d7bd02a6ca2f3e63ecce293067c6f59211da1..f299c7d07eb5178df28a7da98f72911ae4124195 100644 (file)
@@ -440,7 +440,7 @@ void kh_Key_Collect(entity key, entity player)  //a player picks up a dropped ke
                PlayerScore_Add(player, SP_KH_PICKUPS, 1);
        }
        key.kh_dropperteam = 0;
-       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_ENT(key, INFO_KEYHUNT_PICKUP), player.netname);
+       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(key.team, INFO_KEYHUNT_PICKUP), player.netname);
 
        kh_Key_AssignTo(key, player); // this also updates .kh_state
 }
@@ -660,7 +660,7 @@ void kh_LoserTeam(float teem, entity lostkey)  // runs when a player pushes a fl
                }
        }
 
-       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_ENT(lostkey, INFO_KEYHUNT_LOST), lostkey.kh_previous_owner.netname);
+       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(lostkey.team, INFO_KEYHUNT_LOST), lostkey.kh_previous_owner.netname);
 
        play2all(SND(KH_DESTROY));
        te_tarexplosion(lostkey.origin);
@@ -816,7 +816,7 @@ void kh_Key_DropOne(entity key)
 
        kh_Scores_Event(player, key, "dropkey", 0, 0);
        PlayerScore_Add(player, SP_KH_LOSSES, 1);
-       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_ENT(key, INFO_KEYHUNT_DROP), player.netname);
+       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(key.team, INFO_KEYHUNT_DROP), player.netname);
 
        kh_Key_AssignTo(key, NULL);
        makevectors(player.v_angle);
@@ -842,7 +842,7 @@ void kh_Key_DropAll(entity player, float suicide) // runs whenever a player dies
                {
                        kh_Scores_Event(player, key, "losekey", 0, 0);
                        PlayerScore_Add(player, SP_KH_LOSSES, 1);
-                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_ENT(key, INFO_KEYHUNT_LOST), player.netname);
+                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(key.team, INFO_KEYHUNT_LOST), player.netname);
                        kh_Key_AssignTo(key, NULL);
                        makevectors('-1 0 0' * (45 + 45 * random()) + '0 360 0' * random());
                        key.velocity = W_CalculateProjectileVelocity(player, player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, false);