From 977c258392992a20091662c8b67f7df79bbf8a5a Mon Sep 17 00:00:00 2001 From: FruitieX Date: Wed, 9 Jun 2010 13:34:27 +0300 Subject: [PATCH] chat area "panel" --- defaultXonotic.cfg | 10 ++++++++++ qcsrc/client/hud.qc | 43 +++++++++++++++++++++++++++++++++++++++++++ qcsrc/client/hud.qh | 2 +- 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 8343e0221..d7064d5fe 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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" diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index b0af90b82..aff0cac42 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -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")) diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 4b348df87..e4fdd2237 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -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) -- 2.39.2