]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
chat area "panel"
authorFruitieX <rasse@rasse-lappy.localdomain>
Wed, 9 Jun 2010 10:34:27 +0000 (13:34 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Wed, 9 Jun 2010 10:34:27 +0000 (13:34 +0300)
defaultXonotic.cfg
qcsrc/client/hud.qc
qcsrc/client/hud.qh

index 8343e0221b481d033fd6e54f5983399fb0dbdabd..d7064d5feea7426bb1e6d3b4f01acfe484d74820 100644 (file)
@@ -1484,6 +1484,16 @@ seta hud_pressedkeys_bg_alpha "" "if set to something else than \"\" = override
 seta hud_pressedkeys_bg_border "" "if set to something else than \"\" = override default size of border around the background"
 seta hud_pressedkeys_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
 
+seta hud_chat 1 "enable/disable this panel, 1 = show only when spectating other players, 2 = show always"
+seta hud_chat_pos "-0.571569 -0.265625" "position of this base of the panel"
+seta hud_chat_size "0.145098 0.114105" "size of this panel"
+seta hud_chat_bg "" "if set to something else than \"\" = override default background"
+seta hud_chat_bg_color "" "if set to something else than \"\" = override default panel background color"
+seta hud_chat_bg_color_team "" "override panel color with team color in team based games"
+seta hud_chat_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
+seta hud_chat_bg_border "" "if set to something else than \"\" = override default size of border around the background"
+seta hud_chat_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
+
 // scoreboard
 seta scoreboard_columns default
 seta scoreboard_border_thickness 1 "scoreboard border thickness"
index b0af90b825e1490d62f629fd8eab91253810e551..aff0cac42135e544dc7390078cbef4edeb94c7dc 100644 (file)
@@ -565,6 +565,8 @@ string HUD_Panel_GetName(float id)
                case 9: return "vote"; break;
                case 10: return "modicons"; break;
                case 11: return "pressedkeys"; break;
+               case 12: return "chat"; break;
+               case 13: return "connotify"; break;
                default: return "";
        }
 }
@@ -3619,6 +3621,43 @@ void HUD_DrawPressedKeys(void)
        drawpic_skin(pos + eX * mySize_x - eX * 0.372 * mySize_x +      eY * 0.486 * mySize_y, ((pressedkeys & KEY_RIGHT) ? "key_right_inv.tga" : "key_right.tga"),           '1 1 0' * 0.46 * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
 }
 
+// Handle chat as a panel (#12)
+//
+float chat_prevtime;
+void HUD_Chat(void)
+{
+       float id = 12;
+       vector pos, mySize;
+       pos = HUD_Panel_GetPos(id);
+       mySize = HUD_Panel_GetSize(id);
+
+       HUD_Panel_DrawBg(id, pos, mySize);
+       float padding;
+       padding = HUD_Panel_GetPadding(id);
+       if(padding)
+       {
+               pos += '1 1 0' * padding;
+               mySize -= '2 2 0' * padding;
+       }
+
+       cvar_set("con_csqcpositioning", "1");
+
+       cvar_set("con_chatrect_x", ftos(pos_x/vid_conwidth));
+       cvar_set("con_chatrect_y", ftos(pos_y/vid_conheight));
+
+       cvar_set("con_chatwidth", ftos(mySize_x/vid_conwidth));
+       cvar_set("con_chat", ftos(mySize_y/cvar("con_chatsize")));
+
+       if(hud_configure)
+       {
+               if(chat_prevtime != floor(time/3))
+               {
+                       chat_prevtime = floor(time/3);
+                       print("\001Player: This is the chat area\n");
+               }
+       }
+}
+
 /*
 ==================
 Main HUD system
@@ -3792,6 +3831,10 @@ void HUD_Main (void)
        if(HUD_Panel_CheckActive(11))
                if(spectatee_status > 0 || cvar("hud_pressedkeys") >= 2 || hud_configure)
                        HUD_DrawPressedKeys();
+       if(HUD_Panel_CheckActive(12))
+               HUD_Chat();
+       else
+               cvar_set("con_csqcpositioning", "0");
 
        // TODO hud_'ify these
        if (cvar("cl_showspeed"))
index 4b348df8774af7b8887811a235862771fa5fb1d4..e4fdd2237b3a5942279ddf29a6c3807a0e87bf6a 100644 (file)
@@ -1,4 +1,4 @@
-float panel_cnt = 12; // NOTE: IDs start from 0!
+float panel_cnt = 13; // NOTE: IDs start from 0!
 
 vector mousepos;
 vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click)