seta hud_weaponicons_size "0.040000 0.490000" "size of this panel"
seta hud_weaponicons_number 1 "show number of weapon"
seta hud_weaponicons_accuracy_yellow 40 "percentage at which the accuracy color is yellow"
+seta hud_weaponicons_complainbubble 1 "complain bubble (out of ammo, weapon not available etc)"
+seta hud_weaponicons_complainbubble_size 1 "size multiplier of the complain bubble"
+seta hud_weaponicons_complainbubble_time 1 "time that a new entry stays until it fades out"
+seta hud_weaponicons_complainbubble_fadetime 0.25 "fade out time"
seta hud_weaponicons_bg "border_weaponicons" "if set to something else than \"\" = override default background"
seta hud_weaponicons_bg_color "" "if set to something else than \"\" = override default panel background color"
seta hud_weaponicons_bg_color_team "" "override panel color with team color in team based games"
minimapname = strzone(minimapname);
WarpZone_Init();
+ hud_configure_prev = -1;
}
// CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
}
}
+void Net_WeaponComplain() {
+ complain_weapon = ReadByte();
+
+ if(complain_weapon_name)
+ strunzone(complain_weapon_name);
+ complain_weapon_name = strzone(ReadString());
+
+ complain_weapon_type = ReadByte();
+
+ complain_weapon_time = time;
+}
+
// CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
// You must ALWAYS first acquire the temporary ID, which is sent as a byte.
// Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
Net_Notify();
bHandled = true;
break;
+ case TE_CSQC_WEAPONCOMPLAIN:
+ Net_WeaponComplain();
+ bHandled = true;
+ break;
default:
// No special logic for this temporary entity; return 0 so the engine can handle it
bHandled = false;
columns = ceil(WEP_COUNT/rows);
float row, column;
+
+ float a;
+ float when;
+ when = cvar("hud_weaponicons_complainbubble_time");
+ float fadetime;
+ fadetime = cvar("hud_weaponicons_complainbubble_fadetime");
+
for(i = 0; i < weapon_cnt; ++i)
{
self = weaponorder[i];
drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), strcat("weapon", self.netname), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '0 0 0', HUD_Panel_GetFgAlpha(id) * 0.5, DRAWFLAG_NORMAL);
}
+ // draw the complain message
+ if(time - complain_weapon_time < when + fadetime && self.weapon == complain_weapon && cvar("hud_weaponicons_complainbubble"))
+ {
+ if(fadetime)
+ {
+ if(complain_weapon_time + when > time)
+ a = 1;
+ else
+ a = bound(0, (complain_weapon_time + when + fadetime - time) / fadetime, 1);
+ }
+ else
+ {
+ if(complain_weapon_time + when > time)
+ a = 1;
+ else
+ a = 0;
+ }
+
+ vector complain_bubble_size = '100 50 0' * bound(0.25, cvar("hud_weaponicons_complainbubble_size"), 2);
+ drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows) - complain_bubble_size + 0.5 * (eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows)), "weapon_complainbubble", complain_bubble_size, '1 1 1', HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
+
+ string s;
+ vector color;
+ if(complain_weapon_type == 0) {
+ s = "Out of ammo for the";
+ color = '1 0 0';
+ }
+ else if(complain_weapon_type == 1) {
+ s = "You don't have the";
+ color = '1 1 0';
+ }
+ else {
+ s = "Map doesn't have the";
+ color = '1 1 1';
+ }
+ drawstring_aspect(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows) - complain_bubble_size + eX * 0.05 * complain_bubble_size_x + eY * (1/6) * complain_bubble_size_y + 0.5 * (eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows)), s, eX * 0.9 * complain_bubble_size_x + eY * 0.2 * complain_bubble_size_y, 0.2 * complain_bubble_size_y, color, HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows) - complain_bubble_size + eX * 0.05 * complain_bubble_size_x + eY * (11/30) * complain_bubble_size_y + 0.5 * (eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows)), complain_weapon_name, eX * 0.9 * complain_bubble_size_x + eY * 0.25 * complain_bubble_size_y, 0.25 * complain_bubble_size_y, '1 0 0', HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
+ }
+
++row;
if(row >= rows)
{
HUD_Mod_CTF_Reset();
}
-float hud_configure_prev = -1;
void HUD_Main (void)
{
if(disable_menu_alphacheck == 1)
float weapon_fired[WEP_MAXCOUNT];
float weapon_number;
+float complain_weapon;
+string complain_weapon_name;
+float complain_weapon_type;
+float complain_weapon_time;
+
float ps_primary, ps_secondary;
float ts_primary, ts_secondary;
float hud_configure;
float hud_configure_checkcollisions;
+float hud_configure_prev;
float hudShiftState;
const float S_SHIFT = 1;
const float TE_CSQC_ANNOUNCE = 110;
const float TE_CSQC_TARGET_MUSIC = 111;
const float TE_CSQC_NOTIFY = 112;
+const float TE_CSQC_WEAPONCOMPLAIN = 113;
const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
const float RACE_NET_CHECKPOINT_CLEAR = 1;
self.exteriorweaponentity.nextthink = time;
};
+void Send_WeaponComplain (entity e, float wpn, string wpnname, float type)
+{
+ msg_entity = e;
+ WriteByte(MSG_ONE, SVC_TEMPENTITY);
+ WriteByte(MSG_ONE, TE_CSQC_WEAPONCOMPLAIN);
+ WriteByte(MSG_ONE, wpn);
+ WriteString(MSG_ONE, wpnname);
+ WriteByte(MSG_ONE, type);
+}
+
.float hasweapon_complain_spam;
float client_hasweapon(entity cl, float wpn, float andammo, float complain)
{
play2(cl, "weapons/unavailable.wav");
sprint(cl, strcat("You don't have any ammo for the ^2", W_Name(wpn), "\n"));
+ Send_WeaponComplain (cl, wpn, W_Name(wpn), 0);
}
return FALSE;
}
if(weaponsInMap & weaponbit)
{
sprint(cl, strcat("You do not have the ^2", W_Name(wpn), "\n") );
+ Send_WeaponComplain (cl, wpn, W_Name(wpn), 1);
if(cvar("g_showweaponspawns"))
{
}
}
else
+ {
+ Send_WeaponComplain (cl, wpn, W_Name(wpn), 2);
sprint(cl, strcat("The ^2", W_Name(wpn), "^7 is ^1NOT AVAILABLE^7 in this map\n") );
+ }
play2(cl, "weapons/unavailable.wav");
}