// declarations
WEPSET_DECLARE_A(weapons_stat);
WEPSET_COPY_AS(weapons_stat);
- float i, f, a, j, factor;
- float screen_ar, center_x, center_y;
- float weapon_count, weapon_id, weapon_alpha;
+ float i, f, a;
+ float screen_ar, center_x = 0, center_y;
+ float weapon_count, weapon_id;
float row, column, rows, columns;
float aspect = autocvar_hud_panel_weapons_aspect;
- float show_accuracy = false, panel_weapon_accuracy;
+ float panel_weapon_accuracy;
float timeout = autocvar_hud_panel_weapons_timeout;
- float timein_effect_length = (autocvar_hud_panel_weapons_timeout_effect ? 0.375 : 0);
- float timeout_effect_length = (autocvar_hud_panel_weapons_timeout_effect ? 0.75 : 0);
+ float timein_effect_length = autocvar_hud_panel_weapons_timeout_speed_in; //? 0.375 : 0);
+ float timeout_effect_length = autocvar_hud_panel_weapons_timeout_speed_out; //? 0.75 : 0);
float ammo_type, ammo_full;
float barsize_x = 0, barsize_y = 0, baroffset_x = 0, baroffset_y = 0;
{
if((!autocvar_hud_panel_weapons) || (spectatee_status == -1))
return;
- else if(timeout && time >= weapontime + timeout + timeout_effect_length)
+ if(timeout && time >= weapontime + timeout + timeout_effect_length)
+ if(autocvar_hud_panel_weapons_timeout_effect == 3 || (autocvar_hud_panel_weapons_timeout_effect == 1 && !(autocvar_hud_panel_weapons_timeout_fadebgmin + autocvar_hud_panel_weapons_timeout_fadefgmin)))
{
weaponprevtime = time;
return;
draw_beginBoldFont();
- // calculate fading effect to weapon images for when the panel is idle
- if(autocvar_hud_panel_weapons_fade)
- {
- weapon_alpha = 3.2 - 2 * (time - weapontime);
- weapon_alpha = bound(0.7, weapon_alpha, 1) * panel_fg_alpha;
- }
- else
- weapon_alpha = panel_fg_alpha;
-
// figure out weapon order (how the weapons are sorted) // TODO make this configurable
if(weaponorder_bypriority != autocvar_cl_weaponpriority || !weaponorder[0])
{
{
if (timeout && time >= weapontime + timeout) // apply timeout effect if needed
{
- f = (time - (weapontime + timeout)) / timeout_effect_length;
- if (autocvar_hud_panel_weapons_timeout_effect == 1 || autocvar_hud_panel_weapons_timeout_effect == 3)
+ f = bound(0, (time - (weapontime + timeout)) / timeout_effect_length, 1);
+
+ // fade the panel alpha
+ if(autocvar_hud_panel_weapons_timeout_effect == 1)
+ {
+ panel_bg_alpha *= (autocvar_hud_panel_weapons_timeout_fadebgmin * f + (1 - f));
+ panel_fg_alpha *= (autocvar_hud_panel_weapons_timeout_fadefgmin * f + (1 - f));
+ }
+ else if(autocvar_hud_panel_weapons_timeout_effect == 3)
{
panel_bg_alpha *= (1 - f);
panel_fg_alpha *= (1 - f);
}
+
+ // move the panel off the screen
if (autocvar_hud_panel_weapons_timeout_effect == 2 || autocvar_hud_panel_weapons_timeout_effect == 3)
{
f *= f; // for a cooler movement
else //top
panel_pos_y -= f * (panel_pos_y + panel_size_y);
}
+ if(f == 1)
+ center_x = -1; // mark the panel as off screen
}
weaponprevtime = time - (1 - f) * timein_effect_length;
}
else if (timeout && time < weaponprevtime + timein_effect_length) // apply timein effect if needed
{
- f = (time - weaponprevtime) / timein_effect_length;
- if (autocvar_hud_panel_weapons_timeout_effect == 1 || autocvar_hud_panel_weapons_timeout_effect == 3)
+ f = bound(0, (time - weaponprevtime) / timein_effect_length, 1);
+
+ // fade the panel alpha
+ if(autocvar_hud_panel_weapons_timeout_effect == 1)
+ {
+ panel_bg_alpha *= (autocvar_hud_panel_weapons_timeout_fadebgmin * (1 - f) + f);
+ panel_fg_alpha *= (autocvar_hud_panel_weapons_timeout_fadefgmin * (1 - f) + f);
+ }
+ else if(autocvar_hud_panel_weapons_timeout_effect == 3)
{
panel_bg_alpha *= (f);
panel_fg_alpha *= (f);
}
+
+ // move the panel back on screen
if (autocvar_hud_panel_weapons_timeout_effect == 2 || autocvar_hud_panel_weapons_timeout_effect == 3)
{
f *= f; // for a cooler movement
// draw the background, then change the virtual size of it to better fit other items inside
HUD_Panel_DrawBg(1);
+
+ if(center_x == -1)
+ return;
+
if(panel_bg_padding)
{
panel_pos += '1 1 0' * panel_bg_padding;
baroffset_y = (weapon_size_y - barsize_y) / 2;
}
}
-
- if(autocvar_hud_panel_weapons_accuracy && acc_levels)
- {
- show_accuracy = true;
- if (acc_col[0] == '-1 0 0')
- for (i = 0; i < acc_levels; ++i)
- acc_col[i] = stov(cvar_string(strcat("accuracy_color", ftos(i))));
- }
+ if(autocvar_hud_panel_weapons_accuracy)
+ Accuracy_LoadColors();
row = column = 0;
for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
// draw background behind currently selected weapon
if(self.weapon == switchweapon)
- drawpic_aspect_skin(weapon_pos, "weapon_current_bg", weapon_size, '1 1 1', weapon_alpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(weapon_pos, "weapon_current_bg", weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
// draw the weapon accuracy
- if(show_accuracy)
+ if(autocvar_hud_panel_weapons_accuracy)
{
panel_weapon_accuracy = weapon_accuracy[self.weapon-WEP_FIRST];
if(panel_weapon_accuracy >= 0)
{
- // find the max level lower than weapon_accuracy
- j = acc_levels-1;
- while ( j && panel_weapon_accuracy < acc_lev[j] )
- --j;
-
- // inject color j+1 in color j, how much depending on how much weapon_accuracy is higher than level j
- factor = (panel_weapon_accuracy - acc_lev[j]) / (acc_lev[j+1] - acc_lev[j]);
- color = acc_col[j];
- color = color + factor * (acc_col[j+1] - color);
-
+ color = Accuracy_GetColor(panel_weapon_accuracy);
drawpic_aspect_skin(weapon_pos, "weapon_accuracy", weapon_size, color, panel_fg_alpha, DRAWFLAG_NORMAL);
}
}
if(WEPSET_CONTAINS_AW(weapons_stat, self.weapon))
{
// draw the weapon image
- drawpic_aspect_skin(weapon_pos, strcat("weapon", self.netname), weapon_size, '1 1 1', weapon_alpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(weapon_pos, strcat("weapon", self.netname), weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
// draw weapon label string
switch(autocvar_hud_panel_weapons_label)
}*/
}
-void HUD_KillCenterprint(string s1, string s2, float type, float msg)
-{
- float gentle;
- gentle = (autocvar_cl_gentle || autocvar_cl_gentle_messages);
- if(msg == MSG_SUICIDE) {
- if (type == DEATH_TEAMCHANGE) {
- centerprint_hud(sprintf(_("You are now on: %s"), s1));
- } else if (type == DEATH_AUTOTEAMCHANGE) {
- centerprint_hud(sprintf(_("You have been moved into a different team to improve team balance\nYou are now on: %s"), s1));
- } else if (type == DEATH_CAMP) {
- if(gentle)
- centerprint_hud(_("^1Reconsider your tactics, camper!"));
- else
- centerprint_hud(_("^1Die camper!"));
- } else if (type == DEATH_NOAMMO) {
- if(gentle)
- centerprint_hud(_("^1You are reinserted into the game for running out of ammo..."));
- else
- centerprint_hud(_("^1You were killed for running out of ammo..."));
- } else if (type == DEATH_ROT) {
- if(gentle)
- centerprint_hud(_("^1You need to preserve your health"));
- else
- centerprint_hud(_("^1You grew too old without taking your medicine"));
- } else if (type == KILL_TEAM_RED || type == KILL_TEAM_BLUE) {
- if(gentle)
- centerprint_hud(_("^1Don't go against team mates!"));
- else
- centerprint_hud(_("^1Don't shoot your team mates!"));
- } else { // generic message
- if(gentle)
- centerprint_hud(_("^1You need to be more careful!"));
- else
- centerprint_hud(_("^1You killed your own dumb self!"));
- }
- } else if(msg == MSG_KILL) {
- if (type == KILL_TEAM_RED || type == KILL_TEAM_BLUE) {
- if(gentle) {
- centerprint_hud(sprintf(_("^1Moron! You went against ^7%s^1, a team mate!"), s1));
- } else {
- centerprint_hud(sprintf(_("^1Moron! You fragged ^7%s^1, a team mate!"), s1));
- }
- } else if (type == KILL_FIRST_BLOOD) {
- if(gentle) {
- centerprint_hud(_("^1First score"));
- } else {
- centerprint_hud(_("^1First blood"));
- }
- } else if (type == KILL_FIRST_VICTIM) {
- if(gentle) {
- centerprint_hud(_("^1First casualty"));
- } else {
- centerprint_hud(_("^1First victim"));
- }
- } else if (type == KILL_TYPEFRAG) { // s2 contains "advanced kill messages" such as ping, handicap...
- if(gentle) {
- centerprint_hud(strcat(sprintf(_("^1You scored against ^7%s^1 who was typing!"), s1), s2));
- } else {
- centerprint_hud(strcat(sprintf(_("^1You typefragged ^7%s"), s1), s2));
- }
- } else if (type == KILL_TYPEFRAGGED) {
- if(gentle) {
- centerprint_hud(strcat(sprintf(_("^1You were scored against by ^7%s^1 while you were typing!"), s1), s2));
- } else {
- centerprint_hud(strcat(sprintf(_("^1You were typefragged by ^7%s"), s1), s2));
- }
- } else if (type == KILL_FRAG) {
- if(gentle) {
- centerprint_hud(strcat(sprintf(_("^4You scored against ^7%s"), s1), s2));
- } else {
- centerprint_hud(strcat(sprintf(_("^4You fragged ^7%s"), s1), s2));
- }
- } else { // generic message
- if(gentle) {
- centerprint_hud(strcat(sprintf(_("^1You were scored against by ^7%s"), s1), s2));
- } else {
- centerprint_hud(strcat(sprintf(_("^1You were fragged by ^7%s"), s1), s2));
- }
- }
- } else if(msg == MSG_KILL_ACTION) {
- // TODO: invent more centerprints here?
- centerprint_hud(_("^1Watch your step!"));
- }
-}
-
void HUD_Notify(void)
{
if(!autocvar__hud_configure)
float width_attacker;
string attacker, victim, icon;
- float i, j, w, type, step, limit;
+ float i, j, step, limit;
if(autocvar_hud_panel_notify_flip) //order items from the top down
{
i = 0;
if(race_mycheckpointtime)
{
a = bound(0, 2 - (time - race_mycheckpointtime), 1);
- s = MakeRaceString(race_mycheckpoint, TIME_DECODE(race_mycheckpointdelta), -!race_mycheckpointenemy, race_mycheckpointlapsdelta, race_mycheckpointenemy);
+ s = MakeRaceString(race_mycheckpoint, TIME_DECODE(race_mycheckpointdelta), -(race_mycheckpointenemy == ""), race_mycheckpointlapsdelta, race_mycheckpointenemy);
drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.6 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
}
if(race_othercheckpointtime && race_othercheckpointenemy != "")
{
a = bound(0, 2 - (time - race_othercheckpointtime), 1);
- s = MakeRaceString(race_othercheckpoint, -TIME_DECODE(race_othercheckpointdelta), -!race_othercheckpointenemy, race_othercheckpointlapsdelta, race_othercheckpointenemy);
+ s = MakeRaceString(race_othercheckpoint, -TIME_DECODE(race_othercheckpointdelta), -(race_othercheckpointenemy == ""), race_othercheckpointlapsdelta, race_othercheckpointenemy);
drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.6 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
}
return;
// Drawing stuff
- if (hud_skin_path != autocvar_hud_skin)
+ if (hud_skin_prev != autocvar_hud_skin)
{
if (hud_skin_path)
strunzone(hud_skin_path);
hud_skin_path = strzone(strcat("gfx/hud/", autocvar_hud_skin));
+ if (hud_skin_prev)
+ strunzone(hud_skin_prev);
+ hud_skin_prev = strzone(autocvar_hud_skin);
}
// HUD configure visible grid
HUD_Panel_UpdatePosSizeForId(highlightedPanel);
HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha));
}
- if (!hud_configure_prev)
+ if(!hud_configure_prev || hud_configure_prev == -1)
{
if(autocvar_hud_cursormode) { setcursormode(1); }
hudShiftState = 0;