X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fpanel%2Fchat.qc;h=448b9f408f954e2766762a28c0fff2e57ac8f478;hb=51e4f798abb1fc968f37d1ad425eaf5871bb33de;hp=972848260dcc94ab74d4c5fafa735517782d2625;hpb=4da0b1d48eaa7e046fed22cba4709dea8dd5616e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/hud/panel/chat.qc b/qcsrc/client/hud/panel/chat.qc index 972848260..448b9f408 100644 --- a/qcsrc/client/hud/panel/chat.qc +++ b/qcsrc/client/hud/panel/chat.qc @@ -9,26 +9,94 @@ void HUD_Chat_Export(int fh) // allow saving cvars that aesthetically change the panel into hud skin files } +float chat_maximized_scroll_ofs; +float chat_maximized_reset_scroll_time; +float HUD_Panel_Chat_InputEvent(float bInputType, float nPrimary, float nSecondary) +{ + if(!autocvar__con_chat_maximized) + return false; + + if(bInputType == 3) + { + mousepos.x = nPrimary; + mousepos.y = nSecondary; + return true; + } + + if(bInputType == 2) + return false; + + // at this point bInputType can only be 0 or 1 (key pressed or released) + bool key_pressed = (bInputType == 0); + + if(nPrimary == K_MWHEELUP) + { + if (!key_pressed) + return true; + chat_maximized_scroll_ofs += 5 * cvar("con_chatsize"); + return true; + } + else if(nPrimary == K_MWHEELDOWN) + { + if (!key_pressed) + return true; + chat_maximized_scroll_ofs -= 5 * cvar("con_chatsize"); + if (chat_maximized_scroll_ofs < 0) + chat_maximized_scroll_ofs = 0; + return true; + } + else if(nPrimary == K_PGUP) + { + if (!key_pressed) + return true; + chat_maximized_scroll_ofs += vid_conheight / 2; + return true; + } + else if(nPrimary == K_PGDN) + { + if (!key_pressed) + return true; + chat_maximized_scroll_ofs -= vid_conheight / 2; + if (chat_maximized_scroll_ofs < 0) + chat_maximized_scroll_ofs = 0; + return true; + } + + return false; +} + void HUD_Chat() { if(!autocvar__hud_configure) { - if (!autocvar_hud_panel_chat) + if (!autocvar_hud_panel_chat && !autocvar__con_chat_maximized) { - if (!autocvar_con_chatrect) + if (autocvar_con_chatrect) cvar_set("con_chatrect", "0"); + if (autocvar_con_chat != -1) + cvar_set("con_chat", "-1"); return; } + if(autocvar__con_chat_maximized) { if(!hud_draw_maximized) return; + + chat_maximized_reset_scroll_time = time + 3; } - else if(chat_panel_modified) + else { - panel.update_time = time; // forces reload of panel attributes - chat_panel_modified = false; + if(chat_panel_modified) + { + panel.update_time = time; // forces reload of panel attributes + chat_panel_modified = false; + } + if (time > chat_maximized_reset_scroll_time) + chat_maximized_scroll_ofs = 0; } } + else + chat_maximized_scroll_ofs = 0; HUD_Panel_LoadCvars(); @@ -55,6 +123,7 @@ void HUD_Chat() chat_panel_modified = true; } panel_bg_alpha = max(0.75, panel_bg_alpha); + panel_size.y += chat_maximized_scroll_ofs; } vector pos, mySize; @@ -91,7 +160,8 @@ void HUD_Chat() if(autocvar__hud_configure) { 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 + if (cvar_string("con_chatrect_x") != "9001") + cvar_set("con_chatrect_x", "9001"); // over 9000, we'll fake it instead for more control over alpha and such string str = textShortenToWidth(_("^3Player^7: This is the chat area."), mySize.x, chatsize, stringwidth_colors); for(int i = 0; i < autocvar_con_chat; ++i) {