Merge branch 'master' into terencehill/dynamic_hud
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / hud.qh
index 7664abc2f165359ad1b0a849f8feda2e3b322069..3141fa75faf418c89da20b68d7be4d7ce7c4d71f 100644 (file)
@@ -155,6 +155,19 @@ float chat_sizey;
 
 float current_player;
 
+float autocvar_hud_dynamic_follow;
+float autocvar_hud_dynamic_follow_scale;
+
+vector hud_dynamic_shake_realofs;
+float hud_dynamic_shake_factor;
+float hud_dynamic_shake_time;
+
+// shared across viewmodel effects and dynamic hud code
+vector cl_followmodel_ofs;
+float cl_followmodel_time;
+
+vector hud_dynamic_ofs;
+
 float stringwidth_colors(string s, vector theSize);
 float stringwidth_nocolors(string s, vector theSize);
 void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag);
@@ -393,6 +406,15 @@ REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CO
                panel_bg_padding = panel.current_panel_bg_padding;                                                          \
                panel_fg_alpha = panel.current_panel_fg_alpha * hud_fade_alpha;                                             \
        }                                                                                                               \
+       if(hud_dynamic_shake_factor > 0) panel_pos += hud_dynamic_shake_realofs; \
+       if(hud_dynamic_ofs.y) panel_pos.x += hud_dynamic_ofs.y * vid_conwidth; \
+       if(hud_dynamic_ofs.z) panel_pos.y += hud_dynamic_ofs.z * vid_conheight; \
+       if(hud_dynamic_ofs.x) { \
+               panel_size.x += hud_dynamic_ofs.x * panel_size.x; \
+               panel_size.y += hud_dynamic_ofs.x * panel_size.y; \
+               panel_pos.x += hud_dynamic_ofs.x * (panel_pos.x - vid_conwidth * 0.5); \
+               panel_pos.y += hud_dynamic_ofs.x * (panel_pos.y - vid_conheight * 0.5); \
+       } \
 } MACRO_END
 
 #define HUD_Panel_UpdatePosSize() MACRO_BEGIN {                                                                     \