#include <client/defs.qh>
#include <client/miscfunctions.qh>
#include <common/ent_cs.qh>
+#include <common/minigames/cl_minigames.qh>
#include <client/hud/_mod.qh>
#include <client/mapvoting.qh>
QuickMenu_Page_Command_Type[i] = 0;
}
+bool HUD_QuickMenu_Forbidden()
+{
+ return (mv_active
+ || (hud_configure_prev && hud_configure_prev != -1)
+ || HUD_MinigameMenu_IsOpened()
+ || (QuickMenu_TimeOut && time > QuickMenu_TimeOut));
+}
+
+// returns true if succeded, false otherwise
bool QuickMenu_Open(string mode, string submenu, string file)
{
+ QuickMenu_TimeOut = 0;
+ if (HUD_QuickMenu_Forbidden())
+ return false;
+
int fh = -1;
string s;
while((s = fgets(fh)) && QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES)
{
// first skip invalid entries, so we don't check them anymore
- float argc;
+ int argc;
argc = tokenize_console(s);
if(argc == 0 || argv(0) == "")
continue;
else
QuickMenu_Page_Load("", 0);
- hud_panel_quickmenu = 1;
- if(autocvar_hud_cursormode)
- setcursormode(1);
hudShiftState = 0;
QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
for (i = 0; i < QUICKMENU_MAXLINES; ++i)
QuickMenu_Page_ClearEntry(i);
QuickMenu_Page_Entries = 0;
- hud_panel_quickmenu = 0;
mouseClicked = 0;
prevMouseClicked = 0;
QuickMenu_Buffer_Close();
-
- if(autocvar_hud_cursormode)
- if(!mv_active)
- setcursormode(0);
}
// It assumes submenu open tag is already detected
return;
}
- if (!autocvar_hud_cursormode)
- update_mousepos();
-
panel = HUD_PANEL(QUICKMENU);
HUD_Panel_LoadCvars();
QuickMenu_Page_ActiveEntry((entry_num < QUICKMENU_MAXLINES - 1) ? entry_num + 1 : 0);
}
}
-
- draw_cursor_normal(mousepos, '1 1 1', 0.8);
-
- prevMouseClicked = mouseClicked;
}
void HUD_Quickmenu_DrawEntry(vector pos, string desc, string option, vector fontsize)
{
if(!autocvar__hud_configure)
{
- if (hud_configure_prev && hud_configure_prev != -1)
- QuickMenu_Close();
-
- if(!hud_draw_maximized) return;
- if(mv_active) return;
- //if(!autocvar_hud_panel_quickmenu) return;
- if(!hud_panel_quickmenu) return;
+ if (!hud_draw_maximized || !QuickMenu_IsOpened())
+ return;
- if(QuickMenu_TimeOut)
- if(time > QuickMenu_TimeOut)
+ if (HUD_QuickMenu_Forbidden())
{
QuickMenu_Close();
return;
}
.float has_team;
- float SetTeam(entity o, int Team)
+ bool SetTeam(entity o, int Team)
{
TC(int, Team);
devassert_once(Team);
// In the case of mouse input after a setcursormode(1) call, nPrimary is xpos, nSecondary is ypos.
float CSQC_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
- TC(int, bInputType);
- if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
+ TC(int, bInputType);
+ bool override = false;
+ override |= HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary);
+ if (override)
return true;
- if (QuickMenu_InputEvent(bInputType, nPrimary, nSecondary))
- return true;
+ override |= QuickMenu_InputEvent(bInputType, nPrimary, nSecondary);
- if (HUD_Radar_InputEvent(bInputType, nPrimary, nSecondary))
- return true;
+ override |= HUD_Radar_InputEvent(bInputType, nPrimary, nSecondary);
- if (MapVote_InputEvent(bInputType, nPrimary, nSecondary))
- return true;
+ override |= MapVote_InputEvent(bInputType, nPrimary, nSecondary);
+
+ override |= HUD_Minigame_InputEvent(bInputType, nPrimary, nSecondary);
- if (HUD_Minigame_InputEvent(bInputType, nPrimary, nSecondary))
+ if(override)
return true;
return false;
{
for(j = 0; j < maxclients; ++j)
if(playerslots[j])
- playerslots[j].ready = 1;
+ playerslots[j].ready = true;
for(i = 1; i <= maxclients; i += 8)
{
f = ReadByte();
for(j = i-1, b = BIT(0); b < BIT(8); b <<= 1, ++j)
if (!(f & b))
if(playerslots[j])
- playerslots[j].ready = 0;
+ playerslots[j].ready = false;
}
}
if (sf & 1) {
for (int j = 0; j < maxclients; ++j) {
if (playerslots[j]) {
- playerslots[j].eliminated = 1;
+ playerslots[j].eliminated = true;
}
}
for (int i = 1; i <= maxclients; i += 8) {
if (f & BIT(b)) continue;
int j = i - 1 + b;
if (playerslots[j]) {
- playerslots[j].eliminated = 0;
+ playerslots[j].eliminated = false;
}
}
}
#define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOSHADOW | EF_SELECTABLE | EF_TELEPORT_BIT)
float autocvar_cl_viewmodel_scale;
+ float autocvar_cl_viewmodel_alpha;
bool autocvar_cl_bobmodel;
float autocvar_cl_bobmodel_speed;
if(!this.activeweapon || !autocvar_r_drawviewmodel)
return;
int mask = (intermission || (STAT(HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL;
- float a = this.alpha;
- static bool wasinvehicle;
+ float a = ((autocvar_cl_viewmodel_alpha) ? bound(-1, autocvar_cl_viewmodel_alpha, this.m_alpha) : this.m_alpha);
bool invehicle = player_localentnum > maxclients;
if (invehicle) a = -1;
- else if (wasinvehicle) a = 1;
- wasinvehicle = invehicle;
Weapon wep = this.activeweapon;
int c = entcs_GetClientColors(current_player);
vector g = weaponentity_glowmod(wep, NULL, c, this);
vector pos = view_origin;
vector dir = view_forward;
+ makevectors(((autocvar_chase_active) ? warpzone_save_view_angles : view_angles));
+ pos += v_right * -wepent.movedir.y
+ + v_up * wepent.movedir.z;
+
if (wepent.angles_held_status)
{
makevectors(wepent.angles_held);
//draw_cursor(viewloc_mousepos, '0.5 0.5 0', "/cursor_move", '1 1 1', cursor_alpha);
}
+void HUD_Cursor_Show()
+{
+ float cursor_alpha = 1 - autocvar__menu_alpha;
+ if(cursor_type == CURSOR_NORMAL)
+ draw_cursor_normal(mousepos, '1 1 1', cursor_alpha);
+ else if(cursor_type == CURSOR_MOVE)
+ draw_cursor(mousepos, '0.5 0.5 0', "/cursor_move", '1 1 1', cursor_alpha);
+ else if(cursor_type == CURSOR_RESIZE)
+ draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize", '1 1 1', cursor_alpha);
+ else if(cursor_type == CURSOR_RESIZE2)
+ draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize2", '1 1 1', cursor_alpha);
+}
+
+void HUD_Mouse(entity player)
+{
+ if(autocvar__menu_alpha == 1)
+ return;
+
+ if(!cursor_active)
+ {
+ if(player.viewloc && (player.viewloc.spawnflags & VIEWLOC_FREEAIM))
+ ViewLocation_Mouse(); // NOTE: doesn't use cursormode
+ return;
+ }
+
+ if(!autocvar_hud_cursormode)
+ update_mousepos();
+
+ if(autocvar__hud_configure)
+ HUD_Panel_Mouse();
+ else
+ {
+ if (HUD_MinigameMenu_IsOpened() || active_minigame)
+ HUD_Minigame_Mouse();
+ if (QuickMenu_IsOpened())
+ QuickMenu_Mouse();
+ if (HUD_Radar_Clickable())
+ HUD_Radar_Mouse();
+ }
+
+ prevMouseClicked = mouseClicked;
+
+ HUD_Cursor_Show();
+}
+
bool ov_enabled;
float oldr_nearclip;
float oldr_farclip_base;
cvar_set("vid_conheight", h0);
}
- if(autocvar__hud_configure)
- HUD_Panel_Mouse();
- else if (HUD_MinigameMenu_IsOpened() || active_minigame)
- HUD_Minigame_Mouse();
- else if(QuickMenu_IsOpened())
- QuickMenu_Mouse();
- else if(local_player.viewloc && (local_player.viewloc.spawnflags & VIEWLOC_FREEAIM))
- ViewLocation_Mouse(); // NOTE: doesn't use cursormode
- else
- HUD_Radar_Mouse();
+ HUD_Mouse(local_player);
cl_notice_run();
unpause_update();