#include <client/draw.qh>
#include <common/items/inventory.qh>
-bool autocvar_hud_panel_itempickup = true; //LegendGuard adds a bool to enable/disable item pickup display HUD 06-04-2021
-bool autocvar_hud_panel_itempickup_timer = true;
// Chat (#12)
if (autocvar_con_chat != floor(mySize.y / autocvar_con_chatsize - 0.5))
cvar_set("con_chat", ftos(floor(mySize.y / autocvar_con_chatsize - 0.5)));
- vector chatsize = '1 1 0' * autocvar_con_chatsize;
+ //vector chatsize = '1 1 0' * autocvar_con_chatsize;
if(autocvar__hud_configure)
{
vector chatsize = '1 1 0' * autocvar_con_chatsize;
pos.y += chatsize.y;
}
}
-
- // z411 items
- if (autocvar_hud_panel_itempickup)
- {
- float stat_last_pickup = STAT(LAST_PICKUP);
- pos.y += mySize.y;
- entity it = last_pickup_item;
-
- if(stat_last_pickup && stat_last_pickup > time - 3 && it) {
- float a, y;
- string str1, str2, icon;
- vector sz, sz2;
- vector pickupsize = chatsize * 1.25;
- vector iconsize = chatsize * 2;
-
- icon = strcat(hud_skin_path, "/", ((it.model2) ? it.model2 : it.m_icon));
- sz = draw_getimagesize(icon);
- sz2 = vec2(iconsize.y*(sz.x/sz.y), iconsize.y);
- str2 = ((last_pickup_times > 1) ? sprintf("%s (x%d)", it.m_name, last_pickup_times) : it.m_name);
- y = (iconsize.y - pickupsize.y) / 2;
-
- if(time < stat_last_pickup + 3 - 0.5)
- a = 1;
- else
- a = (stat_last_pickup + 3 - time) / 0.5;
-
- if(autocvar_hud_panel_itempickup_timer) {
- if(spectatee_status || !(serverflags & SERVERFLAG_FORBID_PICKUPTIMER)) {
- str1 = seconds_tostring(last_pickup_timer);
- drawstring(pos + eY * y, str1, pickupsize, '1 1 1', a, DRAWFLAG_NORMAL);
- pos.x += stringwidth(str1, false, pickupsize) + pickupsize.x * 0.25;
- }
- }
-
- drawpic(pos, icon, sz2, '1 1 1', a, DRAWFLAG_NORMAL);
- pos.x += sz2.x + pickupsize.x * 0.25;
- drawstring(pos + eY * y, str2, pickupsize, '1 1 1', a, DRAWFLAG_NORMAL);
- }
- }
}
#define COLOR_MED autocvar_hud_panel_scoreboard_ping_medium_color
#define COLOR_HIGH autocvar_hud_panel_scoreboard_ping_high_color
#define COLOR_WORST autocvar_hud_panel_scoreboard_ping_worst_color
+
+vector getPingColor(float f)
+{
+ if(f < PING_BEST)
+ return COLOR_BEST;
+ else if(f < PING_MED)
+ return COLOR_BEST + (COLOR_MED - COLOR_BEST) * ((f - PING_BEST) / (PING_MED - PING_BEST));
+ else if(f < PING_HIGH)
+ return COLOR_MED + (COLOR_HIGH - COLOR_MED) * ((f - PING_MED) / (PING_HIGH - PING_MED));
+ else if(f < PING_WORST)
+ return COLOR_HIGH + (COLOR_WORST - COLOR_HIGH) * ((f - PING_HIGH) / (PING_WORST - PING_HIGH));
+ else
+ return COLOR_WORST;
+}
+
string Scoreboard_GetField(entity pl, PlayerScoreField field, bool per_round)
{
float tmp, num, denom;
f = pl.ping;
if(f == 0)
return _("N/A");
- if(f < PING_BEST)
- sbt_field_rgb = COLOR_BEST;
- else if(f < PING_MED)
- sbt_field_rgb = COLOR_BEST + (COLOR_MED - COLOR_BEST) * ((f - PING_BEST) / (PING_MED - PING_BEST));
- else if(f < PING_HIGH)
- sbt_field_rgb = COLOR_MED + (COLOR_HIGH - COLOR_MED) * ((f - PING_MED) / (PING_HIGH - PING_MED));
- else if(f < PING_WORST)
- sbt_field_rgb = COLOR_HIGH + (COLOR_WORST - COLOR_HIGH) * ((f - PING_HIGH) / (PING_WORST - PING_HIGH));
- else
- sbt_field_rgb = COLOR_WORST;
+ sbt_field_rgb = getPingColor(f);
return ftos(f);
case SP_PL:
string flag_name = "";
vector flag_size = '0 0 0';
- Scoreboard_GetField(pl, SP_COUNTRY);
+ Scoreboard_GetField(pl, SP_COUNTRY, autocvar_hud_panel_scoreboard_scores_per_round);
if(sbt_field_icon3 != "") {
sz = draw_getimagesize(sbt_field_icon3);
//LegendGuard adds a conditional sentence for country column 05-04-2021
// Player country icon/flag
- Scoreboard_GetField(pl, SP_COUNTRY);
+ Scoreboard_GetField(pl, SP_COUNTRY, autocvar_hud_panel_scoreboard_scores_per_round);
if(sbt_field_icon3 != "") {
vector rsz = draw_getimagesize(sbt_field_icon3);
sbt_fixcolumnwidth_iconlen = rsz.x / rsz.y;
else
i++;
- tmp_str = Scoreboard_GetField(pl, SP_PING);
+ tmp_str = Scoreboard_GetField(pl, SP_PING, autocvar_hud_panel_scoreboard_scores_per_round);
drawstring(tmp + eX * column_width * i + (eX * column_width / 2) - eX * (stringwidth(tmp_str, false, hud_fontsize * 1.25) / 2),
tmp_str, hud_fontsize * 1.25, sbt_field_rgb, panel_fg_alpha, DRAWFLAG_NORMAL);
- tmp_str = Scoreboard_GetField(pl, SP_PL);
+ tmp_str = Scoreboard_GetField(pl, SP_PL, autocvar_hud_panel_scoreboard_scores_per_round);
drawstring(tmp + eX * column_width * (invert ? i-- : i++) + (eX * column_width / 2) - eX * (stringwidth(tmp_str, false, hud_fontsize * 0.75) / 2) + eY * (hud_fontsize.y * 1.25),
tmp_str, hud_fontsize * 0.75, sbt_field_rgb, panel_fg_alpha, DRAWFLAG_NORMAL);
if(!intermission_time && !warmup_stage && timelimit > 0)
timer_color = HUD_Timer_Color(timeleft);
-<<<<<<< HEAD
// countdown sound
// if 3 use server dictated option, otherwise the client's
int countdown_type;
}
const GameItem it = REGISTRY_GET(Items, Inventory_groups_minor * i + j);
.int fld = inv_items[it.m_id];
- int prev = this.(fld);
- int next = this.(fld) = ReadByte();
+ int prev = inv.(fld);
+ int next = inv.(fld) = ReadByte();
Pickup_Update(it, next - prev);
LOG_DEBUGF("%s: %.0f -> %.0f", it.m_name, prev, next);
REGISTER_NET_TEMP(TE_CSQC_TEAMNAMES)
REGISTER_NET_TEMP(TE_CSQC_CHATSOUND)
-REGISTER_NET_TEMP(TE_CSQC_WEAPONPICKUP)
REGISTER_NET_TEMP(TE_CSQC_TOTALSHARDS) // for RJZ
const int RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
setcolor(player, stof(autocvar_sv_defaultplayercolors));
}
-void GiveWarmupResources(entity this)
-{
- SetResource(this, RES_SHELLS, warmup_start_ammo_shells);
- SetResource(this, RES_BULLETS, warmup_start_ammo_nails);
- SetResource(this, RES_ROCKETS, warmup_start_ammo_rockets);
- SetResource(this, RES_CELLS, warmup_start_ammo_cells);
- SetResource(this, RES_PLASMA, warmup_start_ammo_plasma);
- SetResource(this, RES_FUEL, warmup_start_ammo_fuel);
- SetResource(this, RES_HEALTH, warmup_start_health);
- SetResource(this, RES_ARMOR, warmup_start_armorvalue);
- STAT(WEAPONS, this) = WARMUP_START_WEAPONS;
+void ResetPlayerResources(entity this)
+{
+ if (warmup_stage) {
+ SetResource(this, RES_SHELLS, warmup_start_ammo_shells);
+ SetResource(this, RES_BULLETS, warmup_start_ammo_nails);
+ SetResource(this, RES_ROCKETS, warmup_start_ammo_rockets);
+ SetResource(this, RES_CELLS, warmup_start_ammo_cells);
+ SetResource(this, RES_PLASMA, warmup_start_ammo_plasma);
+ SetResource(this, RES_FUEL, warmup_start_ammo_fuel);
+ SetResource(this, RES_HEALTH, warmup_start_health);
+ SetResource(this, RES_ARMOR, warmup_start_armorvalue);
+ STAT(WEAPONS, this) = WARMUP_START_WEAPONS;
+ } else {
+ SetResource(this, RES_SHELLS, start_ammo_shells);
+ SetResource(this, RES_BULLETS, start_ammo_nails);
+ SetResource(this, RES_ROCKETS, start_ammo_rockets);
+ SetResource(this, RES_CELLS, start_ammo_cells);
+ SetResource(this, RES_PLASMA, start_ammo_plasma);
+ SetResource(this, RES_FUEL, start_ammo_fuel);
+ SetResource(this, RES_HEALTH, start_health);
+ SetResource(this, RES_ARMOR, start_armorvalue);
+ STAT(WEAPONS, this) = start_weapons;
+ if (MUTATOR_CALLHOOK(ForbidRandomStartWeapons, this) == false)
+ {
+ GiveRandomWeapons(this, random_start_weapons_count,
+ autocvar_g_random_start_weapons, random_start_ammo);
+ }
+ }
}
void PutPlayerInServer(entity this)
this.takedamage = DAMAGE_AIM;
this.effects = EF_TELEPORT_BIT | EF_RESTARTANIM_BIT;
- if (warmup_stage)
- GiveWarmupResources(this);
- else
- {
- SetResource(this, RES_SHELLS, start_ammo_shells);
- SetResource(this, RES_BULLETS, start_ammo_nails);
- SetResource(this, RES_ROCKETS, start_ammo_rockets);
- SetResource(this, RES_CELLS, start_ammo_cells);
- SetResource(this, RES_PLASMA, start_ammo_plasma);
- SetResource(this, RES_FUEL, start_ammo_fuel);
- SetResource(this, RES_HEALTH, start_health);
- SetResource(this, RES_ARMOR, start_armorvalue);
- STAT(WEAPONS, this) = start_weapons;
- if (MUTATOR_CALLHOOK(ForbidRandomStartWeapons, this) == false)
- {
- GiveRandomWeapons(this, random_start_weapons_count,
- autocvar_g_random_start_weapons, random_start_ammo);
- }
- }
+ ResetPlayerResources(this);
+
SetSpectatee_status(this, 0);
PS(this).dual_weapons = '0 0 0';
void FixPlayermodel(entity player);
-void GiveWarmupResources(entity this);
+void ResetPlayerResources(entity this);
void ClientInit_misc(entity this);
game_starttime = time;
Send_Notification(NOTIF_ALL, NULL, MSG_MULTI, COUNTDOWN_STOP, minplayers);
if (!sv_ready_restart_after_countdown) // if we ran reset_map() at start of countdown
- FOREACH_CLIENT(IS_PLAYER(it), { GiveWarmupResources(it); });
+ FOREACH_CLIENT(IS_PLAYER(it), { ResetPlayerResources(it); });
}
if (warmup_limit > 0)
warmup_limit = -1;
{
pickedup = true;
FOREACH(Weapons, it != WEP_Null, {
-<<<<<<< HEAD
- Weapon wep = it;
-
- if(w & (wep.m_wepset)) {
- // z411 Seriously find a better way to do this
- Item_NotifyWeapon(player, wep.m_id);
- FOREACH_CLIENT(IS_SPEC(it) && it.enemy == player, { Item_NotifyWeapon(it, wep.m_id); });
- }
-
- if(wp & (wep.m_wepset))
-=======
if(w & (it.m_wepset))
Item_NotifyWeapon(player, it.m_id);
if(wp & (it.m_wepset))
->>>>>>> master
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
if(player.(weaponentity).m_weapon != WEP_Null || slot == 0)
- W_DropEvent(wr_pickup, player, wep.m_id, item, weaponentity);
+ W_DropEvent(wr_pickup, player, it.m_id, item, weaponentity);
}
- W_GiveWeapon(player, wep.m_id);
+ W_GiveWeapon(player, it.m_id);
}
});
}
bool autocvar_sv_gameplayfix_droptofloorstartsolid;
bool autocvar_sv_gameplayfix_droptofloorstartsolid_nudgetocorrect;
-<<<<<<< HEAD
// z411
bool autocvar_sv_jingle_end;
string autocvar_sv_jingle_end_list;
float fragsleft;
int fragsleft_last;
-=======
bool autocvar_sv_mapformat_is_quake3;
bool autocvar_sv_mapformat_is_quake2;
->>>>>>> master
float checkrules_equality;
float checkrules_suddendeathwarning;