}
vector old_panel_size = panel_size;
- if(panel_bg_padding)
- old_panel_size -= '2 2 0' * panel_bg_padding;
-
- // NOTE: the goal is to use the all-weapons layout and remove unneeded cells
- // this way weapon icons always have the same size regardless of owned weapon count
+ vector padded_panel_size = panel_size - '2 2 0' * panel_bg_padding;
// get the all-weapons layout
- rows = HUD_GetRowCount(WEP_COUNT, old_panel_size, aspect);
- columns = ceil(WEP_COUNT/rows);
- weapon_size.x = old_panel_size.x / columns;
- weapon_size.y = old_panel_size.y / rows;
+ rows = HUD_GetRowCount(WEP_COUNT, padded_panel_size, aspect);
+ columns = ceil(WEP_COUNT / rows);
+ weapon_size.x = padded_panel_size.x / columns;
+ weapon_size.y = padded_panel_size.y / rows;
// reduce rows and columns as needed
- columns = ceil(weapon_count / rows);
- rows = ceil(weapon_count / columns);
-
- // NOTE: although weapons should aways look the same even if onlyowned is disabled,
+ // NOTE: although weapons should aways look the same even if onlyowned is enabled,
// we enlarge them a bit when possible to better match the desired aspect ratio
- // as they look much better
- weapon_size.x = min(old_panel_size.x / columns, aspect * weapon_size.y);
- weapon_size.y = min(old_panel_size.y / rows, weapon_size.x / aspect);
+ if(padded_panel_size.y > padded_panel_size.x)
+ {
+ columns = ceil(weapon_count / rows);
+ rows = ceil(weapon_count / columns);
+ weapon_size.y = min(padded_panel_size.y / rows, weapon_size.x / aspect);
+ weapon_size.x = min(padded_panel_size.x / columns, aspect * weapon_size.y);
+ }
+ else
+ {
+ rows = ceil(weapon_count / columns);
+ columns = ceil(weapon_count / rows);
+ weapon_size.x = min(padded_panel_size.x / columns, aspect * weapon_size.y);
+ weapon_size.y = min(padded_panel_size.y / rows, weapon_size.x / aspect);
+ }
// reduce size of the panel
panel_size.x = columns * weapon_size.x;
panel_size.y = rows * weapon_size.y;
- panel_pos.x += (old_panel_size.x - panel_size.x) / 2;
- panel_pos.y += (old_panel_size.y - panel_size.y) / 2;
- if(panel_bg_padding)
- panel_size += '2 2 0' * panel_bg_padding;
+ panel_size += '2 2 0' * panel_bg_padding;
+
+ // center the resized panel, or snap it to the screen edge when close enough
+ if(panel_pos.x > vid_conwidth * 0.001)
+ {
+ if(panel_pos.x + old_panel_size.x > vid_conwidth * 0.999)
+ panel_pos.x += old_panel_size.x - panel_size.x;
+ else
+ panel_pos.x += (old_panel_size.x - panel_size.x) / 2;
+ }
+ else if(old_panel_size.x > vid_conwidth * 0.999)
+ panel_pos.x += (old_panel_size.x - panel_size.x) / 2;
+
+ if(panel_pos.y > vid_conheight * 0.001)
+ {
+ if(panel_pos.y + old_panel_size.y > vid_conheight * 0.999)
+ panel_pos.y += old_panel_size.y - panel_size.y;
+ else
+ panel_pos.y += (old_panel_size.y - panel_size.y) / 2;
+ }
+ else if(old_panel_size.y > vid_conheight * 0.999)
+ panel_pos.y += (old_panel_size.y - panel_size.y) / 2;
}
else
weapon_count = WEP_COUNT;
}
+// Minigame
+//
+#include "../common/minigames/cl_minigames_hud.qc"
+
/*
==================
Main HUD system
==================
*/
+bool HUD_Panel_CheckFlags(int showflags)
+{
+ if ( HUD_Minigame_Showpanels() )
+ return showflags & PANEL_SHOW_MINIGAME;
+ return showflags & PANEL_SHOW_MAINGAME;
+}
+
+void HUD_Panel_Draw(entity panent)
+{
+ panel = panent;
+ if ( HUD_Panel_CheckFlags(panel.panel_showflags) )
+ panel.panel_draw();
+}
+
void HUD_Reset (void)
{
// reset gametype specific icons
// they must fade only when the menu does
if(scoreboard_fade_alpha == 1)
{
- (panel = HUD_PANEL(CENTERPRINT)).panel_draw();
+ HUD_Panel_Draw(HUD_PANEL(CENTERPRINT));
return;
}
if(!autocvar__hud_configure && !hud_fade_alpha)
+ {
+ hud_fade_alpha = 1;
+ HUD_Panel_Draw(HUD_PANEL(VOTE));
+ hud_fade_alpha = 0;
return;
+ }
// Drawing stuff
if (hud_skin_prev != autocvar_hud_skin)
hud_draw_maximized = 0;
// draw panels in order specified by panel_order array
for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
- (panel = hud_panel[panel_order[i]]).panel_draw();
+ HUD_Panel_Draw(hud_panel[panel_order[i]]);
hud_draw_maximized = 1; // panels that may be maximized must check this var
// draw maximized panels on top
if(hud_panel_radar_maximized)
- (panel = HUD_PANEL(RADAR)).panel_draw();
+ HUD_Panel_Draw(HUD_PANEL(RADAR));
if(autocvar__con_chat_maximized)
- (panel = HUD_PANEL(CHAT)).panel_draw();
+ HUD_Panel_Draw(HUD_PANEL(CHAT));
HUD_Configure_PostDraw();
#include "../common/net_notice.qh"
+#include "../common/minigames/sv_minigames.qh"
+
#include "../common/monsters/sv_monsters.qh"
#include "../warpzonelib/server.qh"
float n, i;
string s;
- // NOTE: we do NOT check crypto_keyfp here, an unsigned ID is fine too for this
+ // NOTE: we do NOT check crypto_idfp_signed here, an unsigned ID is fine too for this
if (!p.crypto_idfp)
return 0;
PlayerStats_GameReport_FinalizePlayer(self);
+ if ( self.active_minigame )
+ part_minigame(self);
+
if(IS_PLAYER(self)) { pointparticles(particleeffectnum("spawn_event_neutral"), self.origin, '0 0 0', 1); }
CheatShutdownClient();
remove(self);
return;
}
- if ((self.owner.BUTTON_CHAT && !self.owner.deadflag)
-#ifdef TETRIS
- || self.owner.tetris_on
-#endif
- )
- self.model = self.mdl;
- else
- self.model = "";
+
+ self.mdl = "";
+
+ if ( !self.owner.deadflag && IS_PLAYER(self.owner) )
+ {
+ if ( self.owner.active_minigame )
+ self.mdl = "models/sprites/minigame_busy.iqm";
+ else if ( self.owner.BUTTON_CHAT )
+ self.mdl = "models/misc/chatbubble.spr";
+ }
+
+ if ( self.model != self.mdl )
+ setmodel(self, self.mdl);
+
}
void UpdateChatBubble()
self.chatbubbleentity.nextthink = time;
setmodel(self.chatbubbleentity, "models/misc/chatbubble.spr"); // precision set below
//setorigin(self.chatbubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1');
- setorigin(self.chatbubbleentity, '0 0 15' + self.maxs.z * '0 0 1');
+ setorigin(self.chatbubbleentity, '0 0 15' + self.maxs_z * '0 0 1');
setattachment(self.chatbubbleentity, self, ""); // sticks to moving player better, also conserves bandwidth
self.chatbubbleentity.mdl = self.chatbubbleentity.model;
- self.chatbubbleentity.model = "";
+ //self.chatbubbleentity.model = "";
self.chatbubbleentity.effects = EF_LOWPRECISION;
}
}
void ObserverThink()
{
+ if ( self.impulse )
+ {
+ MinigameImpulse(self.impulse);
+ self.impulse = 0;
+ }
float prefered_movetype;
if (self.flags & FL_JUMPRELEASED) {
if (self.BUTTON_JUMP && !self.version_mismatch) {
void SpectatorThink()
{
+ if ( self.impulse )
+ {
+ MinigameImpulse(self.impulse);
+ self.impulse = 0;
+ }
if (self.flags & FL_JUMPRELEASED) {
if (self.BUTTON_JUMP && !self.version_mismatch) {
self.flags &= ~FL_JUMPRELEASED;
self.max_armorvalue = 0;
}
-#ifdef TETRIS
- if (TetrisPreFrame())
- return;
-#endif
-
if(self.frozen == 2)
{
self.revive_progress = bound(0, self.revive_progress + frametime * self.revive_speed, 1);
}
}
-#ifdef TETRIS
- if(self.impulse == 100)
- ImpulseCommands();
- if (!TetrisPostFrame())
- {
-#endif
-
CheatFrame();
//CheckPlayerJump();
GetPressedKeys();
}
-#ifdef TETRIS
- }
-#endif
-
/*
float i;
for(i = 0; i < 1000; ++i)