set g_keepawayball_trail_color 254 "particle trail color from player/ball"
set g_keepawayball_damageforcescale 3 "Scale of force which is applied to the ball by weapons/explosions/etc"
set g_keepawayball_respawntime 10 "if no one picks up the ball, how long to wait until the ball respawns"
-seta g_keepaway_teams_override 0
-set g_keepaway_teams 0
// ==========
// =====================
set g_spawn_near_teammate 0 "if set, players prefer spawns near a team mate"
set g_spawn_near_teammate_distance 640 "max distance to consider a spawn to be near a team mate"
+set g_spawn_near_teammate_ignore_spawnpoint 0 "ignore spawnpoints and spawn right at team mates"
+set g_spawn_near_teammate_ignore_spawnpoint_delay 2.5 "how long to wait before its OK to spawn at a player after someone just spawned at this player"
+set g_spawn_near_teammate_ignore_spawnpoint_delay_death 0 "how long to wait before its OK to spawn at a player after death"
+set g_spawn_near_teammate_ignore_spawnpoint_check_health 1 "only allow spawn at this player if their health is full"
+set g_spawn_near_teammate_ignore_spawnpoint_closetodeath 1 "spawn as close to death location as possible"
// ========================
set g_campcheck_interval 10
set g_campcheck_damage 100
set g_campcheck_distance 1800
+
g_mod_physics Xonotic
// current Xonotic physics
-sv_gravity 700
+sv_gravity 720
sv_maxspeed 360
sv_maxairspeed 360
// Xon 0.7: 24+2
// Samual: 31 (just below 32, keeping things smooth without allowing 32qu steps)
+// jump duration == 2*sv_jumpvelocity / sv_gravity
+// in this case: 0.6888888888 (thus either 20 or 21 frames)
// jump height == sv_jumpvelocity^2 / (2*sv_gravity)
-// in this case: 42.87 qu
+// in this case: 42.71
// player: 24+45 qu
-// total: 111.87qu
+// total: 111.71qu
// this is smaller than 112 qu, so a 112 qu high corridor (7 of 8 grid units in
// the 16 grid, and the 8th unit used for wall/floor) just lets a player jump!
-sv_jumpvelocity 245
+sv_jumpvelocity 248
sv_wateraccelerate -1
sv_waterfriction -1
sv_airaccel_sideways_friction 0
float i;
self.classname = "ent_client_scores_info";
gametype = ReadInt24_t();
+ HUD_ModIcons_SetFunc();
for(i = 0; i < MAX_SCORE; ++i)
{
scores_label[i] = strzone(ReadString());
if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS))
Accuracy_LoadLevels();
- HUD_Main(); // always run these functions for alpha checks
- HUD_DrawScoreboard();
+ HUD_Main(); // always run these functions for alpha checks
+ HUD_DrawScoreboard();
- if (scoreboard_active) // scoreboard/accuracy
- HUD_Reset();
- else if (intermission == 2) // map voting screen
- {
- HUD_FinaleOverlay();
- HUD_Reset();
- }
- /*
- switch(hud)
+ if (scoreboard_active) // scoreboard/accuracy
+ HUD_Reset();
+ else if (intermission == 2) // map voting screen
{
- case HUD_SPIDERBOT:
- CSQC_SPIDER_HUD();
- break;
-
- case HUD_WAKIZASHI:
- CSQC_WAKIZASHI_HUD();
- break;
-
- case HUD_BUMBLEBEE:
- CSQC_BUMBLE_HUD();
- break;
+ MapVote_Draw();
+ HUD_Reset();
}
- */
}
float autocvar_hud_panel_weapons_timeout_fadefgmin;
var float autocvar_hud_panel_weapons_timeout_speed_in = 0.25;
var float autocvar_hud_panel_weapons_timeout_speed_out = 0.75;
+vector autocvar_hud_progressbar_acceleration_color;
+vector autocvar_hud_progressbar_acceleration_neg_color;
float autocvar_hud_progressbar_alpha;
+vector autocvar_hud_progressbar_armor_color;
+vector autocvar_hud_progressbar_fuel_color;
+vector autocvar_hud_progressbar_health_color;
+vector autocvar_hud_progressbar_nexball_color;
+vector autocvar_hud_progressbar_shield_color;
+vector autocvar_hud_progressbar_speed_color;
+vector autocvar_hud_progressbar_strength_color;
+vector autocvar_hud_progressbar_superweapons_color;
float autocvar_hud_showbinds;
float autocvar_hud_showbinds_limit;
float autocvar__hud_showbinds_reload;
// own team's color is never forced
float forcecolor_friend = 0;
float forcecolor_enemy = 0;
- float teams_count = 0;
entity tm;
- for(tm = teams.sort_next; tm; tm = tm.sort_next)
- if(tm.team != NUM_SPECTATOR)
- ++teams_count;
-
if(autocvar_cl_forcemyplayercolors)
forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
- if(autocvar_cl_forceplayercolors && teams_count == 2)
+ if(autocvar_cl_forceplayercolors && team_count == 2)
forcecolor_enemy = 1024 + autocvar__cl_color;
if(forcecolor_enemy && !forcecolor_friend)
// draw the background/borders
#define HUD_Panel_DrawBg(theAlpha)\
-if(panel_bg != "0" && panel_bg != "")\
- draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER))
+if(panel.current_panel_bg != "0" && panel.current_panel_bg != "")\
+ draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel.current_panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER))
//basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, float vertical, float baralign, vector theColor, float theAlpha, float drawflag)
// update generic hud functions
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
draw_beginBoldFont();
weapon_size_y = old_panel_size_y / rows;
// change table values to include only the owned weapons
- // weapon_size won't be changed
+ float columns_save = columns;
if(weapon_count <= rows)
{
rows = weapon_count;
else
columns = ceil(weapon_count / rows);
+ // enlarge weapon_size to match desired aspect ratio in order to capitalize on panel space
+ if(columns < columns_save)
+ weapon_size_x = min(old_panel_size_x / columns, aspect * weapon_size_y);
+
// reduce size of the panel
panel_size_x = columns * weapon_size_x;
panel_size_y = rows * weapon_size_y;
void HUD_Ammo(void)
{
- if(hud != HUD_NORMAL) return;
+ if(hud != HUD_NORMAL) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_ammo) return;
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
draw_beginBoldFont();
mySize -= '2 2 0' * panel_bg_padding;
}
+ const float AMMO_COUNT = 4;
float rows = 0, columns, row, column;
vector ammo_size;
if (autocvar_hud_panel_ammo_onlycurrent)
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
draw_beginBoldFont();
const float maxshield = 30;
float shield = ceil(shield_time);
if(autocvar_hud_panel_powerups_progressbar)
- {
- HUD_Panel_GetProgressBarColor(shield);
- HUD_Panel_DrawProgressBar(pos + shield_offset, mySize, autocvar_hud_panel_powerups_progressbar_shield, shield/maxshield, is_vertical, shield_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- }
+ HUD_Panel_DrawProgressBar(pos + shield_offset, mySize, autocvar_hud_panel_powerups_progressbar_shield, shield/maxshield, is_vertical, shield_baralign, autocvar_hud_progressbar_shield_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
if(autocvar_hud_panel_powerups_text)
{
if(shield > 1)
const float maxstrength = 30;
float strength = ceil(strength_time);
if(autocvar_hud_panel_powerups_progressbar)
- {
- HUD_Panel_GetProgressBarColor(strength);
- HUD_Panel_DrawProgressBar(pos + strength_offset, mySize, autocvar_hud_panel_powerups_progressbar_strength, strength/maxstrength, is_vertical, strength_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- }
+ HUD_Panel_DrawProgressBar(pos + strength_offset, mySize, autocvar_hud_panel_powerups_progressbar_strength, strength/maxstrength, is_vertical, strength_baralign, autocvar_hud_progressbar_strength_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
if(autocvar_hud_panel_powerups_text)
{
if(strength > 1)
const float maxsuperweapons = 30;
float superweapons = ceil(superweapons_time);
if(autocvar_hud_panel_powerups_progressbar)
- {
- HUD_Panel_GetProgressBarColor(superweapons);
- HUD_Panel_DrawProgressBar(pos + superweapons_offset, mySize, autocvar_hud_panel_powerups_progressbar_superweapons, superweapons/maxsuperweapons, is_vertical, superweapons_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- }
+ HUD_Panel_DrawProgressBar(pos + superweapons_offset, mySize, autocvar_hud_panel_powerups_progressbar_superweapons, superweapons/maxsuperweapons, is_vertical, superweapons_baralign, autocvar_hud_progressbar_superweapons_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
if(autocvar_hud_panel_powerups_text)
{
if(superweapons > 1)
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
vector pos, mySize;
pos = panel_pos;
mySize = panel_size;
{
biggercount = "health";
if(autocvar_hud_panel_healtharmor_progressbar)
- {
- HUD_Panel_GetProgressBarColor(health);
- HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_health, x/maxtotal, 0, (baralign == 1 || baralign == 2), progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- }
+ HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_health, x/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_health_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
if(armor)
if(autocvar_hud_panel_healtharmor_text)
drawpic_aspect_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "armor", '0.5 0.5 0' * mySize_y, '1 1 1', panel_fg_alpha * armor / health, DRAWFLAG_NORMAL);
{
biggercount = "armor";
if(autocvar_hud_panel_healtharmor_progressbar)
- {
- HUD_Panel_GetProgressBarColor(armor);
- HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, x/maxtotal, 0, (baralign == 1 || baralign == 2), progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- }
+ HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, x/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
if(health)
if(autocvar_hud_panel_healtharmor_text)
drawpic_aspect_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "health", '0.5 0.5 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
DrawNumIcon(pos, mySize, x, biggercount, 0, iconalign, HUD_Get_Num_Color(x, maxtotal), 1);
if(fuel)
- {
- HUD_Panel_GetProgressBarColor(fuel);
- HUD_Panel_DrawProgressBar(pos, eX * mySize_x + eY * 0.2 * mySize_y, "progressbar", fuel/100, 0, (baralign == 1 || baralign == 3), progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
- }
+ HUD_Panel_DrawProgressBar(pos, eX * mySize_x + eY * 0.2 * mySize_y, "progressbar", fuel/100, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
}
else
{
{
if(autocvar_hud_panel_healtharmor_progressbar)
{
- HUD_Panel_GetProgressBarColor(health);
float p_health, pain_health_alpha;
p_health = health;
pain_health_alpha = 1;
if (time - health_damagetime < 1)
{
float health_damagealpha = 1 - (time - health_damagetime)*(time - health_damagetime);
- HUD_Panel_DrawProgressBar(pos + health_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_health, health_beforedamage/maxhealth, is_vertical, health_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * health_damagealpha, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawProgressBar(pos + health_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_health, health_beforedamage/maxhealth, is_vertical, health_baralign, autocvar_hud_progressbar_health_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * health_damagealpha, DRAWFLAG_NORMAL);
}
}
prev_health = health;
pain_health_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
}
}
- HUD_Panel_DrawProgressBar(pos + health_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_health, p_health/maxhealth, is_vertical, health_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * pain_health_alpha, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawProgressBar(pos + health_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_health, p_health/maxhealth, is_vertical, health_baralign, autocvar_hud_progressbar_health_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * pain_health_alpha, DRAWFLAG_NORMAL);
}
if(autocvar_hud_panel_healtharmor_text)
DrawNumIcon(pos + health_offset, mySize, health, "health", is_vertical, health_iconalign, HUD_Get_Num_Color(health, maxhealth), 1);
{
if(autocvar_hud_panel_healtharmor_progressbar)
{
- HUD_Panel_GetProgressBarColor(armor);
float p_armor;
p_armor = armor;
if (autocvar_hud_panel_healtharmor_progressbar_gfx)
if (time - armor_damagetime < 1)
{
float armor_damagealpha = 1 - (time - armor_damagetime)*(time - armor_damagetime);
- HUD_Panel_DrawProgressBar(pos + armor_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, armor_beforedamage/maxarmor, is_vertical, armor_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * armor_damagealpha, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawProgressBar(pos + armor_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, armor_beforedamage/maxarmor, is_vertical, armor_baralign, autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * armor_damagealpha, DRAWFLAG_NORMAL);
}
}
prev_armor = armor;
}
- HUD_Panel_DrawProgressBar(pos + armor_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, p_armor/maxarmor, is_vertical, armor_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawProgressBar(pos + armor_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, p_armor/maxarmor, is_vertical, armor_baralign, autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
if(autocvar_hud_panel_healtharmor_text)
DrawNumIcon(pos + armor_offset, mySize, armor, "armor", is_vertical, armor_iconalign, HUD_Get_Num_Color(armor, maxarmor), 1);
mySize_x *= 2; //restore full panel size
else if (panel_ar < 1/4)
mySize_y *= 2; //restore full panel size
- HUD_Panel_GetProgressBarColor(fuel);
- HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", fuel/100, is_vertical, fuel_baralign, progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", fuel/100, is_vertical, fuel_baralign, autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
}
}
}
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
vector pos, mySize;
pos = panel_pos;
mySize = panel_size;
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
draw_beginBoldFont();
{
if (autocvar_hud_panel_radar == 0) return;
if (autocvar_hud_panel_radar != 2 && !teamplay) return;
+ if(radar_panel_modified)
+ {
+ panel.update_time = time; // forces reload of panel attributes
+ radar_panel_modified = false;
+ }
}
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
float f = 0;
panel_pos_x = (vid_conwidth - panel_size_x) / 2;
panel_pos_y = (vid_conheight - panel_size_y) / 2;
+ string panel_bg;
panel_bg = strcat(hud_skin_path, "/border_default"); // always use the default border when maximized
- if(precache_pic(panel_bg) == "") { panel_bg = "gfx/hud/default/border_default"; } // fallback
+ if(precache_pic(panel_bg) == "")
+ panel_bg = "gfx/hud/default/border_default"; // fallback
+ if(!radar_panel_modified && panel_bg != panel.current_panel_bg)
+ radar_panel_modified = true;
+ if(panel.current_panel_bg)
+ strunzone(panel.current_panel_bg);
+ panel.current_panel_bg = strzone(panel_bg);
switch(hud_panel_radar_maximized_zoommode)
{
// Score (#7)
//
void HUD_UpdatePlayerTeams();
-void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
+void HUD_Score_Rankings(vector pos, vector mySize, entity me)
{
float score;
entity tm = world, pl;
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
vector pos, mySize;
pos = panel_pos;
mySize = panel_size;
} else if (!teamplay) { // non-teamgames
if ((spectatee_status == -1 && !autocvar__hud_configure) || autocvar_hud_panel_score_rankings)
{
- HUD_Score_Rankings(pos, mySize, me, 0);
+ HUD_Score_Rankings(pos, mySize, me);
return;
}
// me vector := [team/connected frags id]
drawstring_aspect(pos + eX * 0.75 * mySize_x, distribution_str, eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
draw_endBoldFont();
} else { // teamgames
- float scores_count = 0, row, column, rows = 0, columns = 0;
+ float row, column, rows = 0, columns = 0;
local noref vector offset = '0 0 0';
vector score_pos, score_size; //for scores other than myteam
- if (spectatee_status == -1 || autocvar_hud_panel_score_rankings)
+ if(autocvar_hud_panel_score_rankings)
+ {
+ HUD_Score_Rankings(pos, mySize, me);
+ return;
+ }
+ if(spectatee_status == -1)
{
- for(tm = teams.sort_next; tm, tm.team != NUM_SPECTATOR; tm = tm.sort_next)
- ++scores_count;
- if (autocvar_hud_panel_score_rankings)
- {
- HUD_Score_Rankings(pos, mySize, me, scores_count);
- return;
- }
rows = mySize_y/mySize_x;
- rows = bound(1, floor((sqrt(4 * (3/1) * rows * scores_count + rows * rows) + rows + 0.5) / 2), scores_count);
+ rows = bound(1, floor((sqrt(4 * (3/1) * rows * team_count + rows * rows) + rows + 0.5) / 2), team_count);
// ^^^ ammo item aspect goes here
- columns = ceil(scores_count/rows);
+ columns = ceil(team_count/rows);
score_size = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
draw_beginBoldFont();
return;
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
if(uid2name_dialog)
{
void HUD_Mod_CA(vector myPos, vector mySize)
{
mod_active = 1; // required in each mod function that always shows something
- entity tm;
- float teams_count = 0;
- for(tm = teams.sort_next; tm; tm = tm.sort_next)
- if(tm.team != NUM_SPECTATOR)
- ++teams_count;
float layout;
if(gametype == MAPINFO_TYPE_CA)
float rows, columns, aspect_ratio;
rows = mySize_y/mySize_x;
aspect_ratio = (layout) ? 2 : 1;
- rows = bound(1, floor((sqrt((4 * aspect_ratio * teams_count + rows) * rows) + rows + 0.5) / 2), teams_count);
- columns = ceil(teams_count/rows);
+ rows = bound(1, floor((sqrt((4 * aspect_ratio * team_count + rows) * rows) + rows + 0.5) / 2), team_count);
+ columns = ceil(team_count/rows);
int i;
float row = 0, column = 0;
vector pos, itemSize;
itemSize = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
- for(i=0; i<teams_count; ++i)
+ for(i=0; i<team_count; ++i)
{
pos = myPos + eX * column * itemSize_x + eY * row * itemSize_y;
if (p > 1)
p = 2 - p;
- //Draw the filling
- HUD_Panel_GetProgressBarColor(nexball);
- if(mySize_x > mySize_y)
- HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", p, 0, 0, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- else
- HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", p, 1, 0, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", p, (mySize_x <= mySize_y), 0, autocvar_hud_progressbar_nexball_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
if (stat_items & IT_KEY1)
void HUD_Mod_Dom(vector myPos, vector mySize)
{
mod_active = 1; // required in each mod function that always shows something
- entity tm;
- float teams_count = 0;
- for(tm = teams.sort_next; tm; tm = tm.sort_next)
- if(tm.team != NUM_SPECTATOR)
- ++teams_count;
float layout = autocvar_hud_panel_modicons_dom_layout;
float rows, columns, aspect_ratio;
rows = mySize_y/mySize_x;
aspect_ratio = (layout) ? 3 : 1;
- rows = bound(1, floor((sqrt((4 * aspect_ratio * teams_count + rows) * rows) + rows + 0.5) / 2), teams_count);
- columns = ceil(teams_count/rows);
+ rows = bound(1, floor((sqrt((4 * aspect_ratio * team_count + rows) * rows) + rows + 0.5) / 2), team_count);
+ columns = ceil(team_count/rows);
int i;
float row = 0, column = 0;
vector pos, itemSize;
itemSize = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
- for(i=0; i<teams_count; ++i)
+ for(i=0; i<team_count; ++i)
{
pos = myPos + eX * column * itemSize_x + eY * row * itemSize_y;
}
}
+void HUD_ModIcons_SetFunc()
+{
+ switch(gametype)
+ {
+ case MAPINFO_TYPE_KEYHUNT: HUD_ModIcons_GameType = HUD_Mod_KH; break;
+ case MAPINFO_TYPE_CTF: HUD_ModIcons_GameType = HUD_Mod_CTF; break;
+ case MAPINFO_TYPE_NEXBALL: HUD_ModIcons_GameType = HUD_Mod_NexBall; break;
+ case MAPINFO_TYPE_CTS:
+ case MAPINFO_TYPE_RACE: HUD_ModIcons_GameType = HUD_Mod_Race; break;
+ case MAPINFO_TYPE_CA:
+ case MAPINFO_TYPE_FREEZETAG: HUD_ModIcons_GameType = HUD_Mod_CA; break;
+ case MAPINFO_TYPE_DOMINATION: HUD_ModIcons_GameType = HUD_Mod_Dom; break;
+ case MAPINFO_TYPE_KEEPAWAY: HUD_ModIcons_GameType = HUD_Mod_Keepaway; break;
+ }
+}
+
float mod_prev; // previous state of mod_active to check for a change
float mod_alpha;
float mod_change; // "time" when mod_active changed
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_modicons) return;
- if (gametype != MAPINFO_TYPE_CTF && gametype != MAPINFO_TYPE_KEYHUNT && gametype != MAPINFO_TYPE_NEXBALL && gametype != MAPINFO_TYPE_CTS && gametype != MAPINFO_TYPE_RACE && gametype != MAPINFO_TYPE_CA && gametype != MAPINFO_TYPE_FREEZETAG && gametype != MAPINFO_TYPE_KEEPAWAY && gametype != MAPINFO_TYPE_DOMINATION) return;
+ if(!HUD_ModIcons_GameType) return;
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
draw_beginBoldFont();
- vector pos, mySize;
- pos = panel_pos;
- mySize = panel_size;
-
if(mod_active != mod_prev) {
mod_change = time;
mod_prev = mod_active;
if(panel_bg_padding)
{
- pos += '1 1 0' * panel_bg_padding;
- mySize -= '2 2 0' * panel_bg_padding;
+ panel_pos += '1 1 0' * panel_bg_padding;
+ panel_size -= '2 2 0' * panel_bg_padding;
}
- // these MUST be ran in order to update mod_active
- if(gametype == MAPINFO_TYPE_KEYHUNT)
- HUD_Mod_KH(pos, mySize);
- else if(gametype == MAPINFO_TYPE_CTF || autocvar__hud_configure)
- HUD_Mod_CTF(pos, mySize); // forcealpha only needed for ctf icons, as only they are shown in config mode
- else if(gametype == MAPINFO_TYPE_NEXBALL)
- HUD_Mod_NexBall(pos, mySize);
- else if(gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE)
- HUD_Mod_Race(pos, mySize);
- else if(gametype == MAPINFO_TYPE_CA || gametype == MAPINFO_TYPE_FREEZETAG)
- HUD_Mod_CA(pos, mySize);
- else if(gametype == MAPINFO_TYPE_DOMINATION)
- HUD_Mod_Dom(pos, mySize);
- else if(gametype == MAPINFO_TYPE_KEEPAWAY)
- HUD_Mod_Keepaway(pos, mySize);
+ if(autocvar__hud_configure)
+ HUD_Mod_CTF(panel_pos, panel_size);
+ else
+ HUD_ModIcons_GameType(panel_pos, panel_size);
draw_endBoldFont();
}
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
vector pos, mySize;
pos = panel_pos;
mySize = panel_size;
return;
}
if(autocvar__con_chat_maximized)
+ {
if(!hud_draw_maximized) return;
+ }
+ else if(chat_panel_modified)
+ {
+ panel.update_time = time; // forces reload of panel attributes
+ chat_panel_modified = false;
+ }
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
if(autocvar__con_chat_maximized && !autocvar__hud_configure) // draw at full screen height if maximized
{
panel_pos_y = panel_bg_border;
panel_size_y = vid_conheight - panel_bg_border * 2;
- if(panel_bg == "0") // force a border when maximized
+ if(panel.current_panel_bg == "0") // force a border when maximized
{
- if(precache_pic(panel_bg) == "") {
- panel_bg = strcat(hud_skin_path, "/border_default");
- if(precache_pic(panel_bg) == "") {
- panel_bg = "gfx/hud/default/border_default";
- }
- }
+ string panel_bg;
+ panel_bg = strcat(hud_skin_path, "/border_default");
+ if(precache_pic(panel_bg) == "")
+ panel_bg = "gfx/hud/default/border_default";
+ if(panel.current_panel_bg)
+ strunzone(panel.current_panel_bg);
+ panel.current_panel_bg = strzone(panel_bg);
+ chat_panel_modified = true;
}
panel_bg_alpha = max(0.75, panel_bg_alpha); // force an theAlpha of at least 0.75
}
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
vector pos, mySize;
pos = panel_pos;
mySize = panel_size;
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
vector pos, mySize;
pos = panel_pos;
mySize = panel_size;
}
HUD_Panel_UpdateCvars();
- HUD_Panel_ApplyFadeAlpha();
draw_beginBoldFont();
//draw speed
if(speed)
if(autocvar_hud_panel_physics_progressbar == 1 || autocvar_hud_panel_physics_progressbar == 2)
- {
- HUD_Panel_GetProgressBarColor(speed);
- HUD_Panel_DrawProgressBar(panel_pos + speed_offset, panel_size, "progressbar", speed/max_speed, 0, speed_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- }
+ HUD_Panel_DrawProgressBar(panel_pos + speed_offset, panel_size, "progressbar", speed/max_speed, 0, speed_baralign, autocvar_hud_progressbar_speed_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
vector tmp_offset = '0 0 0', tmp_size = '0 0 0';
if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 2)
{
peak_offset_x = (1 - min(top_speed, max_speed)/max_speed) * panel_size_x;
else // if (speed_baralign == 2)
peak_offset_x = min(top_speed, max_speed)/max_speed * panel_size_x * 0.5;
- //if speed is not 0 the speed progressbar already fetched the color
- if (speed == 0)
- HUD_Panel_GetProgressBarColor(speed);
peak_size_x = floor(panel_size_x * 0.01 + 1.5);
peak_size_y = panel_size_y;
if (speed_baralign == 2) // draw two peaks, on both sides
{
- drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size_x + peak_offset_x - peak_size_x), peak_size, progressbar_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size_x - peak_offset_x + peak_size_x), peak_size, progressbar_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size_x + peak_offset_x - peak_size_x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size_x - peak_offset_x + peak_size_x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
else
- drawfill(panel_pos + speed_offset + eX * (peak_offset_x - peak_size_x), peak_size, progressbar_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawfill(panel_pos + speed_offset + eX * (peak_offset_x - peak_size_x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
//top speed
if(acceleration)
if(autocvar_hud_panel_physics_progressbar == 1 || autocvar_hud_panel_physics_progressbar == 3)
{
- if (acceleration < 0)
- HUD_Panel_GetProgressBarColor(acceleration_neg);
+ vector progressbar_color;
+ if(acceleration < 0)
+ progressbar_color = autocvar_hud_progressbar_acceleration_neg_color;
else
- HUD_Panel_GetProgressBarColor(acceleration);
+ progressbar_color = autocvar_hud_progressbar_acceleration_color;
f = acceleration/autocvar_hud_panel_physics_acceleration_max;
if (autocvar_hud_panel_physics_acceleration_progressbar_nonlinear)
}
}
+ // this panel fades only when the menu does
+ float hud_fade_alpha_save = 0;
+ if(scoreboard_fade_alpha)
+ {
+ hud_fade_alpha_save = hud_fade_alpha;
+ hud_fade_alpha = 1 - autocvar__menu_alpha;
+ }
HUD_Panel_UpdateCvars();
- // this panel doesn't fade when showing the scoreboard
- if(autocvar__menu_alpha)
- HUD_Panel_ApplyFadeAlpha();
-
if(scoreboard_fade_alpha)
{
+ hud_fade_alpha = hud_fade_alpha_save;
+
// move the panel below the scoreboard
if (scoreboard_bottom >= 0.96 * vid_conheight)
return;
if(scoreboard_fade_alpha)
hud_fade_alpha = (1 - scoreboard_fade_alpha);
- if(autocvar__hud_configure)
- if(isdemo())
- HUD_Configure_Exit_Force();
+ HUD_Configure_Frame();
if(intermission == 2) // no hud during mapvote
- {
- if (autocvar__hud_configure)
- HUD_Configure_Exit_Force();
hud_fade_alpha = 0;
- }
- else if(autocvar__menu_alpha == 0 && scoreboard_fade_alpha == 0)
- hud_fade_alpha = 1;
// panels that we want to be active together with the scoreboard
- // they must call HUD_Panel_ApplyFadeAlpha(); only when showing the menu
+ // they must fade only when the menu does
if(scoreboard_fade_alpha == 1)
{
(panel = HUD_PANEL(CENTERPRINT)).panel_draw();
hud_skin_prev = strzone(autocvar_hud_skin);
}
- // HUD configure visible grid
- if(autocvar__hud_configure && autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
- {
- hud_configure_gridSize_x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
- hud_configure_gridSize_y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
- hud_configure_realGridSize_x = hud_configure_gridSize_x * vid_conwidth;
- hud_configure_realGridSize_y = hud_configure_gridSize_y * vid_conheight;
- vector s;
- // x-axis
- s = eX + eY * vid_conheight;
- for(i = 1; i < 1/hud_configure_gridSize_x; ++i)
- drawfill(eX * i * hud_configure_realGridSize_x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
- // y-axis
- s = eY + eX * vid_conwidth;
- for(i = 1; i < 1/hud_configure_gridSize_y; ++i)
- drawfill(eY * i * hud_configure_realGridSize_y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
- }
-
#ifdef COMPAT_XON050_ENGINE
current_player = (spectatee_status > 0) ? spectatee_status : player_localentnum;
#else
if(autocvar__con_chat_maximized)
(panel = HUD_PANEL(CHAT)).panel_draw();
- if(autocvar__hud_configure)
- {
- if(tab_panel)
- {
- panel = tab_panel;
- HUD_Panel_UpdatePosSize()
- drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
- }
- if(highlightedPanel)
- {
- panel = highlightedPanel;
- HUD_Panel_UpdatePosSize()
- HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha));
- }
- if(!hud_configure_prev || hud_configure_prev == -1)
- {
- if(autocvar_hud_cursormode) { setcursormode(1); }
- hudShiftState = 0;
- for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
- hud_panel[panel_order[i]].update_time = time;
- }
- }
- else if(hud_configure_prev && hud_configure_prev != -1 && autocvar_hud_cursormode)
- setcursormode(0);
+ HUD_Configure_PostDraw();
hud_configure_prev = autocvar__hud_configure;
-
- if (!autocvar__hud_configure) // hud config mode disabled, enable normal theAlpha stuff again
- if (menu_enabled)
- menu_enabled = 0;
}
float hud_draw_maximized;
float hud_panel_radar_maximized;
+float chat_panel_modified;
+float radar_panel_modified;
vector mousepos;
vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click)
const float S_ALT = 4;
float menu_enabled; // 1 showing the entire HUD, 2 showing only the clicked panel
-float menu_enabled_time;
float hud_fade_alpha;
vector myteamcolors;
-var vector progressbar_color;
-
entity highlightedPanel_backup;
var vector panel_pos_backup;
var vector panel_size_backup;
var float panel_enabled;
var vector panel_pos;
var vector panel_size;
-var string panel_bg;
var string panel_bg_str; // "_str" vars contain the raw value of the cvar, non-"_str" contains what hud.qc code should use
var vector panel_bg_color;
var string panel_bg_color_str;
// ----------------------
// Little help for the poor people who have to make sense of this: Start from the bottom ;)
-#define HUD_Panel_GetProgressBarColor(item) \
- progressbar_color = stov(cvar_string("hud_progressbar_" #item "_color"))
-#define HUD_Panel_GetProgressBarColorForString(item) \
-switch(item) {\
- case "health": HUD_Panel_GetProgressBarColor(health); break;\
- case "armor": HUD_Panel_GetProgressBarColor(armor); break;\
- case "strength": HUD_Panel_GetProgressBarColor(strength); break;\
- case "shield": HUD_Panel_GetProgressBarColor(shield); break;\
- case "fuel": HUD_Panel_GetProgressBarColor(fuel); break;\
- case "nexball": HUD_Panel_GetProgressBarColor(nexball); break;\
- case "speed": HUD_Panel_GetProgressBarColor(speed); break;\
- case "acceleration": HUD_Panel_GetProgressBarColor(acceleration); break;\
- case "acceleration_neg": HUD_Panel_GetProgressBarColor(acceleration_neg); break;\
-} ENDS_WITH_CURLY_BRACE
-
-// Get value for panel_bg: if "" fetch default, else use panel_bg_str
+// Get value for panel.current_panel_bg: if "" fetch default, else use panel_bg_str
// comment on last line of macro: // we probably want to see a background in config mode at all times...
#define HUD_Panel_GetBg()\
+string panel_bg;\
if(!autocvar__hud_configure && panel_bg_str == "0") {\
panel_bg = "0";\
} else {\
}\
}\
}\
-}
+}\
+if(panel.current_panel_bg)\
+ strunzone(panel.current_panel_bg);\
+panel.current_panel_bg = strzone(panel_bg);
// Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.
#define HUD_Panel_GetColor()\
panel_bg_color_team = stof(panel_bg_color_team_str);\
}
-// the check doesn't allow to fade this panel when showing the panel-specific menu dialog
-#define HUD_Panel_ApplyFadeAlpha()\
-if(!(menu_enabled == 2 && panel == highlightedPanel))\
-{\
- panel_bg_alpha *= hud_fade_alpha;\
- panel_fg_alpha *= hud_fade_alpha;\
-} ENDS_WITH_CURLY_BRACE
-
// Get value for panel_bg_alpha: if "" fetch default, else use panel_bg_alpha. Also do various menu dialog fadeout/in checks, and minalpha checks
// comment on line 3 of macro: // do not set a minalpha cap when showing the config dialog for this panel
#define HUD_Panel_GetBgAlpha()\
panel_bg_border = stof(panel_bg_border_str);\
} ENDS_WITH_CURLY_BRACE
-// Scale the pos and size vectors to absolute coordinates
-#define HUD_Panel_GetScaledVectors()\
-panel_pos_x *= vid_conwidth;\
-panel_pos_y *= vid_conheight;\
-panel_size_x *= vid_conwidth;\
-panel_size_y *= vid_conheight;
-
// Get padding. See comments above, it's similar.
// last line is a port of the old function, basically always make sure the panel contents are at least 5 pixels tall/wide, to disallow extreme padding values
#define HUD_Panel_GetPadding()\
}\
panel_bg_padding = min(min(panel_size_x, panel_size_y)/2 - 5, panel_bg_padding);
-// Point to the macros above (stupid max macro length)
-#define HUD_Panel_GetStringVars()\
-HUD_Panel_GetBg()\
-if (panel_bg != "0") {\
- HUD_Panel_GetColorTeam()\
- HUD_Panel_GetColor()\
- HUD_Panel_GetBgAlpha()\
- HUD_Panel_GetBorder()\
-}\
-HUD_Panel_GetFgAlpha()\
-HUD_Panel_GetScaledVectors()\
-HUD_Panel_GetPadding()
-
-// return smoothly faded pos of given panel when a dialog is active
-var vector menu_enable_panelpos;
-#define HUD_Panel_GetMenuPos() \
-if(panel_size_x > panel_size_y)\
- menu_enable_panelpos = eX * 0.5 * vid_conwidth - eX * 0.5 * panel_size_x + eY * 0.82 * vid_conheight;\
-else\
- menu_enable_panelpos = eY * 0.5 * vid_conheight - eY * 0.5 * panel_size_y + eX * 0.7 * vid_conwidth;\
-panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * menu_enable_panelpos;
-
-// return smoothly faded size of given panel when a dialog is active
-//var vector menu_enable_maxsize;
-var float menu_enable_maxsize_x;
-var float menu_enable_maxsize_y;
-var vector menu_enable_size;
-#define HUD_Panel_GetMenuSize()\
-menu_enable_maxsize_x = 0.3 * vid_conwidth;\
-menu_enable_maxsize_y = 0.18 * vid_conheight;\
+// return smoothly faded pos and size of given panel when a dialog is active
+#define HUD_Panel_UpdatePosSize_ForMenu()\
+vector menu_enable_pos;\
+vector menu_enable_size = '0 0 0';\
+float menu_enable_maxsize_x = 0.3 * vid_conwidth;\
+float menu_enable_maxsize_y = 0.18 * vid_conheight;\
if(panel_size_x > panel_size_y)\
{\
if(panel_size_y > menu_enable_maxsize_y)\
menu_enable_size_x = panel_size_x * (menu_enable_maxsize_y/panel_size_y);\
panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * menu_enable_size;\
}\
+ menu_enable_pos = eX * 0.5 * vid_conwidth - eX * 0.5 * panel_size_x + eY * (vid_conheight - menu_enable_maxsize_y);\
}\
else\
{\
menu_enable_size_y = panel_size_y * (menu_enable_maxsize_x/panel_size_x);\
panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * menu_enable_size;\
}\
-}
+ menu_enable_pos = eY * 0.5 * vid_conheight - eY * 0.5 * panel_size_y + eX * (vid_conwidth - menu_enable_maxsize_x);\
+}\
+panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * menu_enable_pos;
+
+// Scale the pos and size vectors to absolute coordinates
+#define HUD_Panel_ScalePosSize()\
+panel_pos_x *= vid_conwidth; panel_pos_y *= vid_conheight;\
+panel_size_x *= vid_conwidth; panel_size_y *= vid_conheight;
// NOTE: in hud_configure mode cvars must be reloaded every frame
#define HUD_Panel_UpdateCvars() \
if(autocvar__hud_configure) panel_enabled = cvar(strcat("hud_panel_", panel.panel_name)); \
panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \
panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size"))); \
+ HUD_Panel_ScalePosSize() \
panel_bg_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg")); \
panel_bg_color_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color")); \
panel_bg_color_team_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color_team")); \
panel_bg_alpha_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_alpha")); \
panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \
panel_bg_padding_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_padding")); \
- HUD_Panel_GetStringVars()\
+ HUD_Panel_GetBg()\
+ if (panel.current_panel_bg != "0") {\
+ HUD_Panel_GetColorTeam()\
+ HUD_Panel_GetColor()\
+ HUD_Panel_GetBgAlpha()\
+ HUD_Panel_GetBorder()\
+ }\
+ HUD_Panel_GetFgAlpha()\
+ HUD_Panel_GetPadding()\
+ panel.current_panel_bg_alpha = panel_bg_alpha; \
+ panel.current_panel_fg_alpha = panel_fg_alpha; \
if(menu_enabled == 2 && panel == highlightedPanel) {\
- HUD_Panel_GetMenuSize()\
- HUD_Panel_GetMenuPos()\
- } \
+ HUD_Panel_UpdatePosSize_ForMenu()\
+ } else {\
+ panel_bg_alpha *= hud_fade_alpha;\
+ panel_fg_alpha *= hud_fade_alpha;\
+ }\
panel.current_panel_pos = panel_pos; \
panel.current_panel_size = panel_size; \
- if(panel.current_panel_bg) \
- strunzone(panel.current_panel_bg); \
- if(panel_bg == "")\
- {\
- /*printf("^xf08 %s panel: panel_bg is empty\n", panel.panel_name);*/\
- panel_bg = "0";\
- }\
- panel.current_panel_bg = strzone(panel_bg); \
- panel.current_panel_bg_alpha = panel_bg_alpha; \
panel.current_panel_bg_border = panel_bg_border; \
panel.current_panel_bg_color = panel_bg_color; \
panel.current_panel_bg_color_team = panel_bg_color_team; \
panel.current_panel_bg_padding = panel_bg_padding; \
- panel.current_panel_fg_alpha = panel_fg_alpha; \
panel.update_time = (autocvar__hud_configure) ? time : time + autocvar_hud_panel_update_interval; \
} else { \
panel_pos = panel.current_panel_pos; \
panel_size = panel.current_panel_size; \
- panel_bg = panel.current_panel_bg; \
- if(panel.current_panel_bg == "")\
- {\
- /*printf("^xf08 %s panel: panel.current_panel_bg is empty\n", panel.panel_name);*/\
- panel_bg = "0";\
- }\
- panel_bg_alpha = panel.current_panel_bg_alpha; \
+ panel_bg_alpha = panel.current_panel_bg_alpha * hud_fade_alpha; \
panel_bg_border = panel.current_panel_bg_border; \
panel_bg_color = panel.current_panel_bg_color; \
panel_bg_color_team = panel.current_panel_bg_color_team; \
panel_bg_padding = panel.current_panel_bg_padding; \
- panel_fg_alpha = panel.current_panel_fg_alpha; \
+ panel_fg_alpha = panel.current_panel_fg_alpha * hud_fade_alpha; \
} ENDS_WITH_CURLY_BRACE
#define HUD_Panel_UpdatePosSize() {\
panel_enabled = cvar(strcat("hud_panel_", panel.panel_name)); \
panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \
panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size"))); \
-HUD_Panel_GetScaledVectors()\
+HUD_Panel_ScalePosSize()\
if(menu_enabled == 2 && panel == highlightedPanel) {\
- HUD_Panel_GetMenuSize()\
- HUD_Panel_GetMenuPos()\
+ HUD_Panel_UpdatePosSize_ForMenu()\
}\
panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \
HUD_Panel_GetBorder() \
string notify_attackers[KN_MAX_ENTRIES];
string notify_victims[KN_MAX_ENTRIES];
void HUD_Notify_Push(string icon, string attacker, string victim);
+
+var void HUD_ModIcons_GameType(vector pos, vector size);
+void HUD_ModIcons_SetFunc();
if(!autocvar__hud_configure)
return false;
- // block any input while a menu dialog is fading
- if(autocvar__menu_alpha)
- return true;
-
if(bInputType == 3)
{
mousepos_x = nPrimary;
return true;
}
+ // block any input while a menu dialog is fading
+ // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
+ if(autocvar__menu_alpha)
+ {
+ hudShiftState = 0;
+ mouseClicked = 0;
+ return true;
+ }
+
// allow console bind to work
string con_keys;
float keys;
if (bInputType == 1)
return true;
menu_enabled = 1;
- menu_enabled_time = time;
localcmd("menu_showhudexit\n");
}
else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
void HUD_Panel_EnableMenu()
{
menu_enabled = 2;
- menu_enabled_time = time;
localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
}
float mouse_over_panel;
void HUD_Panel_Mouse()
{
- // TODO: needs better check... is there any float that contains the current state of the menu? _menu_alpha isn't apparently updated the frame the menu gets enabled
- if (autocvar__menu_alpha == 0 && time - menu_enabled_time > 0.5)
- menu_enabled = 0;
-
- /*
- print("menu_enabled: ", ftos(menu_enabled), "\n");
- print("Highlighted: ", ftos(highlightedPanel), "\n");
- print("Menu theAlpha: ", ftos(autocvar__menu_alpha), "\n");
- */
-
if(autocvar__menu_alpha == 1)
return;
prevMouseClicked = mouseClicked;
}
+void HUD_Configure_DrawGrid()
+{
+ float i;
+ if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
+ {
+ hud_configure_gridSize_x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
+ hud_configure_gridSize_y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
+ hud_configure_realGridSize_x = hud_configure_gridSize_x * vid_conwidth;
+ hud_configure_realGridSize_y = hud_configure_gridSize_y * vid_conheight;
+ vector s;
+ // x-axis
+ s = eX + eY * vid_conheight;
+ for(i = 1; i < 1/hud_configure_gridSize_x; ++i)
+ drawfill(eX * i * hud_configure_realGridSize_x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
+ // y-axis
+ s = eY + eX * vid_conwidth;
+ for(i = 1; i < 1/hud_configure_gridSize_y; ++i)
+ drawfill(eY * i * hud_configure_realGridSize_y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
+ }
+}
+
+float _menu_alpha_prev;
+void HUD_Configure_Frame()
+{
+ float i;
+ if(autocvar__hud_configure)
+ {
+ if(isdemo() || intermission == 2)
+ {
+ HUD_Configure_Exit_Force();
+ return;
+ }
+
+ if(!hud_configure_prev || hud_configure_prev == -1)
+ {
+ if(autocvar_hud_cursormode)
+ setcursormode(1);
+ hudShiftState = 0;
+ for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
+ hud_panel[panel_order[i]].update_time = time;
+ }
+
+ // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
+ if(autocvar__menu_alpha != _menu_alpha_prev)
+ {
+ if(autocvar__menu_alpha == 0)
+ menu_enabled = 0;
+ _menu_alpha_prev = autocvar__menu_alpha;
+ }
+
+ HUD_Configure_DrawGrid();
+ }
+ else if(hud_configure_prev)
+ {
+ if(menu_enabled)
+ menu_enabled = 0;
+ if(autocvar_hud_cursormode)
+ setcursormode(0);
+ }
+}
const float hlBorderSize = 4;
const string hlBorder = "gfx/hud/default/border_highlighted";
drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize, hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size_y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize + eX * (panel_size_x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size_y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
}
+
+void HUD_Configure_PostDraw()
+{
+ if(autocvar__hud_configure)
+ {
+ if(tab_panel)
+ {
+ panel = tab_panel;
+ HUD_Panel_UpdatePosSize()
+ drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
+ }
+ if(highlightedPanel)
+ {
+ panel = highlightedPanel;
+ HUD_Panel_UpdatePosSize()
+ HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha));
+ }
+ }
+}
entity players;
entity teams;
+var float team_count; // real teams
void AuditLists()
{
if(teams.sort_next)
teams.sort_next.sort_prev = Team;
teams.sort_next = Team;
+ if(Team.team && Team.team != NUM_SPECTATOR)
+ ++team_count;
AuditLists();
return true;
}
parent.sort_next = Team.sort_next;
if(Team.sort_next)
Team.sort_next.sort_prev = parent;
+ if(Team.team && Team.team != NUM_SPECTATOR)
+ --team_count;
AuditLists();
}
}
}
-void MapVote_Draw();
-void HUD_FinaleOverlay()
-{
- /*vector pos;
- pos_x = (vid_conwidth - 1)/2;
- pos_y = 16;
- pos_z = 0;*/
-
- //drawpic(pos, "gfx/finale", '0 0 0', '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-
- //drawstring(pos, "END", hud_fontsize, '1 1 1', 1, DRAWFLAG_NORMAL);
- MapVote_Draw();
-}
-
void Cmd_HUD_SetFields(float argc);
void HUD_InitScores()
{
// returns location of sprite text
vector drawspritearrow(vector o, float ang, vector rgb, float a, float t)
{
- float SQRT2 = 1.414;
- float BORDER; BORDER = 1.5 * t;
- float TSIZE; TSIZE = 8 * t;
- float RLENGTH; RLENGTH = 8 * t;
- float RWIDTH; RWIDTH = 4 * t;
- float MLENGTH; MLENGTH = 4 * t;
+ float size = 9.0 * t;
+ float border = 1.5 * t;
+ float margin = 4.0 * t;
+
+ float borderDiag = border * 1.414;
+ vector arrowX = eX * size;
+ vector arrowY = eY * (size+borderDiag);
+ vector borderX = eX * (size+borderDiag);
+ vector borderY = eY * (size+borderDiag+border);
R_BeginPolygon("", DRAWFLAG_NORMAL);
- R_PolygonVertex(o + rotate(eX * -(TSIZE + BORDER * (1 + SQRT2)) + eY * (TSIZE + BORDER), ang), '0 0 0', '0 0 0', a);
- R_PolygonVertex(o + rotate(eX * (TSIZE + BORDER * (1 + SQRT2)) + eY * (TSIZE + BORDER), ang), '0 0 0', '0 0 0', a);
- R_PolygonVertex(o + rotate(eY * -( BORDER * SQRT2), ang), '0 0 0', '0 0 0', a);
- R_EndPolygon();
- R_BeginPolygon("", DRAWFLAG_NORMAL);
- R_PolygonVertex(o + rotate(eX * -(RWIDTH + BORDER) + eY * (TSIZE + BORDER), ang), '0 0 0', '0 0 0', a);
- R_PolygonVertex(o + rotate(eX * -(RWIDTH + BORDER) + eY * (TSIZE + RLENGTH + BORDER), ang), '0 0 0', '0 0 0', a);
- R_PolygonVertex(o + rotate(eX * (RWIDTH + BORDER) + eY * (TSIZE + RLENGTH + BORDER), ang), '0 0 0', '0 0 0', a);
- R_PolygonVertex(o + rotate(eX * (RWIDTH + BORDER) + eY * (TSIZE + BORDER), ang), '0 0 0', '0 0 0', a);
+ R_PolygonVertex(o, '0 0 0', '0 0 0', a);
+ R_PolygonVertex(o + rotate(arrowY - borderX, ang), '0 0 0', '0 0 0', a);
+ R_PolygonVertex(o + rotate(borderY - borderX, ang), '0 0 0', '0 0 0', a);
+ R_PolygonVertex(o + rotate(borderY + borderX, ang), '0 0 0', '0 0 0', a);
+ R_PolygonVertex(o + rotate(arrowY + borderX, ang), '0 0 0', '0 0 0', a);
R_EndPolygon();
R_BeginPolygon("", DRAWFLAG_ADDITIVE);
- R_PolygonVertex(o + rotate(eX * -TSIZE + eY * TSIZE, ang), '0 0 0', rgb, a);
- R_PolygonVertex(o + rotate(eX * TSIZE + eY * TSIZE, ang), '0 0 0', rgb, a);
- R_PolygonVertex(o + rotate('0 0 0', ang), '0 0 0', rgb, a);
- R_EndPolygon();
- R_BeginPolygon("", DRAWFLAG_ADDITIVE);
- R_PolygonVertex(o + rotate(eX * -RWIDTH + eY * TSIZE, ang), '0 0 0', rgb, a);
- R_PolygonVertex(o + rotate(eX * -RWIDTH + eY * (TSIZE + RLENGTH), ang), '0 0 0', rgb, a);
- R_PolygonVertex(o + rotate(eX * RWIDTH + eY * (TSIZE + RLENGTH), ang), '0 0 0', rgb, a);
- R_PolygonVertex(o + rotate(eX * RWIDTH + eY * TSIZE, ang), '0 0 0', rgb, a);
+ R_PolygonVertex(o + rotate(eY * borderDiag, ang), '0 0 0', rgb, a);
+ R_PolygonVertex(o + rotate(arrowY - arrowX, ang), '0 0 0', rgb, a);
+ R_PolygonVertex(o + rotate(arrowY + arrowX, ang), '0 0 0', rgb, a);
R_EndPolygon();
- return
- o + rotate(eY * (TSIZE + RLENGTH + MLENGTH), ang);
+ return o + rotate(eY * (borderDiag+size+margin), ang);
}
// returns location of sprite healthbar
const float IT_PICKUPMASK = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately
const float IT_UNLIMITED_AMMO = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO;
-const float AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
-
// variables:
string weaponorder_byid;
float autocvar_g_campcheck_distance;
float autocvar_g_campcheck_interval;
float autocvar_g_jump_grunt;
+float autocvar_g_spawn_near_teammate_distance;
+float autocvar_g_spawn_near_teammate_ignore_spawnpoint;
+float autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
+float autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
+float autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health;
+float autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath;
}
else if(team_id == 0) // auto team
{
+ CheckAllowedTeams(client);
team_id = Team_NumberToTeam(FindSmallestTeam(client, FALSE));
}
else
{ if(cvar(mut_cvar) && dependence) { MUTATOR_ADD(mut_name); } }
CHECK_MUTATOR_ADD("g_dodging", mutator_dodging, 1);
- CHECK_MUTATOR_ADD("g_spawn_near_teammate", mutator_spawn_near_teammate, 1);
+ CHECK_MUTATOR_ADD("g_spawn_near_teammate", mutator_spawn_near_teammate, teamplay);
CHECK_MUTATOR_ADD("g_physical_items", mutator_physical_items, 1);
CHECK_MUTATOR_ADD("g_touchexplode", mutator_touchexplode, 1);
CHECK_MUTATOR_ADD("g_minstagib", mutator_minstagib, 1);
if (trace_startsolid)
setorigin(_nade, e.origin);
- if(e.crouch)
- _nade.velocity = '0 0 -10';
+ if(self.v_angle_x >= 70 && self.v_angle_x <= 110)
+ _nade.velocity = '0 0 100';
else if(autocvar_g_nades_nade_newton_style == 1)
_nade.velocity = e.velocity + _velocity;
else if(autocvar_g_nades_nade_newton_style == 2)
_nade.velocity = _velocity;
else
_nade.velocity = W_CalculateProjectileVelocity(e.velocity, _velocity, TRUE);
-
- //_nade.solid = SOLID_BBOX; // TODO: remember why this was needed
+
_nade.touch = nade_touch;
_nade.health = autocvar_g_nades_nade_health;
_nade.max_health = _nade.health;
-float autocvar_g_spawn_near_teammate_distance;
.entity msnt_lookat;
+.float msnt_timer;
+.vector msnt_deathloc;
+
MUTATOR_HOOKFUNCTION(msnt_Spawn_Score)
{
+ if(autocvar_g_spawn_near_teammate_ignore_spawnpoint)
+ return 0;
+
entity p;
spawn_spot.msnt_lookat = world;
MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
{
- if(spawn_spot.msnt_lookat)
+ if(autocvar_g_spawn_near_teammate_ignore_spawnpoint)
+ {
+ if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death)
+ self.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
+
+ entity team_mate, best_mate = world;
+ vector best_spot = '0 0 0';
+ float pc = 0, best_dist = 0, dist = 0;
+ FOR_EACH_PLAYER(team_mate)
+ {
+ if((autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health >= 0 && team_mate.health >= autocvar_g_balance_health_regenstable) || autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health == 0)
+ if(team_mate.deadflag == DEAD_NO)
+ if(team_mate.msnt_timer < time)
+ if(SAME_TEAM(self, team_mate))
+ if(time > team_mate.spawnshieldtime) // spawn shielding
+ if(team_mate.freezetag_frozen == 0)
+ if(team_mate != self)
+ {
+ tracebox(team_mate.origin, PL_MIN, PL_MAX, team_mate.origin - '0 0 100', MOVE_WORLDONLY, team_mate);
+ if(trace_fraction != 1.0)
+ if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
+ {
+ pc = pointcontents(trace_endpos + '0 0 1');
+ if(pc == CONTENT_EMPTY)
+ {
+ if(vlen(team_mate.velocity) > 5)
+ fixedmakevectors(vectoangles(team_mate.velocity));
+ else
+ fixedmakevectors(team_mate.angles);
+
+ for(pc = 0; pc != 5; ++pc) // test 5 diffrent spots close to mate
+ {
+ switch(pc)
+ {
+ case 0:
+ tracebox(team_mate.origin , PL_MIN, PL_MAX, team_mate.origin + v_right * 128, MOVE_NORMAL, team_mate);
+ break;
+ case 1:
+ tracebox(team_mate.origin , PL_MIN, PL_MAX, team_mate.origin - v_right * 128 , MOVE_NORMAL, team_mate);
+ break;
+ case 2:
+ tracebox(team_mate.origin , PL_MIN, PL_MAX, team_mate.origin + v_right * 64 - v_forward * 64, MOVE_NORMAL, team_mate);
+ break;
+ case 3:
+ tracebox(team_mate.origin , PL_MIN, PL_MAX, team_mate.origin - v_right * 64 - v_forward * 64, MOVE_NORMAL, team_mate);
+ break;
+ case 4:
+ tracebox(team_mate.origin , PL_MIN, PL_MAX, team_mate.origin - v_forward * 128, MOVE_NORMAL, team_mate);
+ break;
+ }
+
+ if(trace_fraction == 1.0)
+ {
+ traceline(trace_endpos + '0 0 4', trace_endpos - '0 0 100', MOVE_NORMAL, team_mate);
+ if(trace_fraction != 1.0)
+ {
+ if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath)
+ {
+ dist = vlen(trace_endpos - self.msnt_deathloc);
+ if(dist < best_dist || best_dist == 0)
+ {
+ best_dist = dist;
+ best_spot = trace_endpos;
+ best_mate = team_mate;
+ }
+ }
+ else
+ {
+ setorigin(self, trace_endpos);
+ self.angles = team_mate.angles;
+ self.angles_z = 0; // never spawn tilted even if the spot says to
+ self.fixangle = TRUE; // turn this way immediately
+ team_mate.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
+ return 0;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath)
+ if(best_dist)
+ {
+ setorigin(self, best_spot);
+ self.angles = best_mate.angles;
+ self.angles_z = 0; // never spawn tilted even if the spot says to
+ self.fixangle = TRUE; // turn this way immediately
+ best_mate.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
+ }
+ }
+ else if(spawn_spot.msnt_lookat)
{
self.angles = vectoangles(spawn_spot.msnt_lookat.origin - self.origin);
self.angles_x = -self.angles_x;
+ self.angles_z = 0; // never spawn tilted even if the spot says to
+ self.fixangle = TRUE; // turn this way immediately
/*
sprint(self, "You should be looking at ", spawn_spot.msnt_lookat.netname, "^7.\n");
sprint(self, "distance: ", vtos(spawn_spot.msnt_lookat.origin - self.origin), "\n");
return 0;
}
+MUTATOR_HOOKFUNCTION(msnt_PlayerDies)
+{
+ self.msnt_deathloc = self.origin;
+ return 0;
+}
+
MUTATOR_DEFINITION(mutator_spawn_near_teammate)
{
MUTATOR_HOOK(Spawn_Score, msnt_Spawn_Score, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerSpawn, msnt_PlayerSpawn, CBC_ORDER_ANY);
+ MUTATOR_HOOK(PlayerDies, msnt_PlayerDies, CBC_ORDER_ANY);
return 0;
}
if (!self.speed)
self.speed = 100;
+ if (!InitMovingBrushTrigger())
+ return;
+ self.effects |= EF_LOWPRECISION;
+
if (self.spawnflags & 2)
{
self.platmovetype_turn = TRUE;
else
self.view_ofs = self.mins;
- if (!InitMovingBrushTrigger())
- return;
- self.effects |= EF_LOWPRECISION;
-
// wait for targets to spawn
InitializeEntity(self, func_train_find, INITPRIO_SETLOCATION);
}
if(autocvar_g_start_weapon_laser == 0)
modifications = strcat(modifications, ", No start weapons");
- if(autocvar_sv_gravity < 800)
+ if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
modifications = strcat(modifications, ", Low gravity");
if(g_cloaked && !g_cts)
modifications = strcat(modifications, ", Cloaked");