seta crosshair_color_by_health 0 "if enabled, crosshair color will depend on current health"
// ring around crosshair, used for various purposes (such as indicating bullets left in clip, nex charge)
+seta crosshair_ring 1 "main cvar to enable or disable crosshair rings"
+seta crosshair_ring_inner 0 "allow inner rings to be drawn too"
seta crosshair_ring_size 2 "bullet counter ring size for Rifle, velocity ring for Nex"
seta crosshair_ring_alpha 0.2 "ring alpha"
+seta crosshair_ring_sniperrifle 1 "draw a ring showing the ammount of ammo left in the sniperrifle
seta crosshair_ring_sniperrifle_alpha 0.15
-seta crosshair_ring_nex_outer_alpha 0.15
+seta crosshair_ring_nex 1 "draw a ring showing the current charge of the nexgun"
+seta crosshair_ring_nex_alpha 0.15
seta crosshair_ring_nex_inner_alpha 0.15
seta crosshair_ring_nex_inner_color_red 0.8
seta crosshair_ring_nex_inner_color_green 0
seta crosshair_ring_nex_currentcharge_scale 30
seta crosshair_ring_nex_currentcharge_movingavg_rate 0.05
+seta crosshair_ring_minelayer 1
+seta crosshair_ring_minelayer_alpha 0.15
+
seta cl_reticle_stretch 0 "whether to stretch reticles so they fit the screen (brakes image proportions)"
seta cl_reticle_item_nex 1 "draw aiming reticle for the nex weapon's zoom, 0 disables and values between 0 and 1 change alpha"
seta cl_reticle_item_normal 1 "draw reticle when zooming with the zoom button, 0 disables and values between 0 and 1 change alpha"
// TrueAim check
float shottype;
- float bullets, ring_scale;
// wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
wcross_origin = project_3d_to_2d(view_origin + MAX_SHOT_DISTANCE * view_forward);
wcross_origin_z = 0;
wcross_scale *= 1 - autocvar__menu_alpha;
wcross_alpha *= 1 - autocvar__menu_alpha;
-
- ring_scale = autocvar_crosshair_ring_size;
-
wcross_size = drawgetimagesize(wcross_name) * wcross_scale;
- float nex_charge, nex_chargepool;
- nex_charge = getstatf(STAT_NEX_CHARGE);
- nex_chargepool = getstatf(STAT_NEX_CHARGEPOOL);
-
- if(nex_charge_movingavg == 0) // this should only happen if we have just loaded up the game
- nex_charge_movingavg = nex_charge;
-
- // ring around crosshair representing bullets left in camping rifle clip
- if (activeweapon == WEP_SNIPERRIFLE && cr_maxbullets)
- {
- bullets = getstati(STAT_BULLETS_LOADED);
- f = bound(0, bullets / cr_maxbullets, 1);
-
- a = autocvar_crosshair_ring_sniperrifle_alpha;
- DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring_sniperrifle.tga", f, wcross_color, wcross_alpha * a, DRAWFLAG_ADDITIVE);
- }
- else if (activeweapon == WEP_NEX && nex_charge) // ring around crosshair representing velocity-dependent damage for the nex
+ if (autocvar_crosshair_ring)
{
- if(nex_chargepool || use_nex_chargepool)
+ float ring_value, ring_alpha, ring_inner_value, ring_inner_alpha;
+ string ring_image, ring_inner_image;
+ vector ring_rgb, ring_inner_rgb;
+
+ float ring_scale = autocvar_crosshair_ring_size;
+
+ float nex_charge, nex_chargepool;
+ nex_charge = getstatf(STAT_NEX_CHARGE);
+ nex_chargepool = getstatf(STAT_NEX_CHARGEPOOL);
+
+ if(nex_charge_movingavg == 0) // this should only happen if we have just loaded up the game
+ nex_charge_movingavg = nex_charge;
+
+ if (activeweapon == WEP_SNIPERRIFLE && cr_maxbullets && autocvar_crosshair_ring_sniperrifle) // ring around crosshair representing bullets left in camping rifle clip
+ {
+ ring_value = bound(0, getstati(STAT_BULLETS_LOADED) / cr_maxbullets, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
+ ring_alpha = wcross_alpha * autocvar_crosshair_ring_sniperrifle_alpha;
+ ring_image = "gfx/crosshair_ring_sniperrifle.tga";
+ ring_rgb = wcross_color;
+ }
+ else if (activeweapon == WEP_NEX && nex_charge && autocvar_crosshair_ring_nex) // ring around crosshair representing velocity-dependent damage for the nex
{
- use_nex_chargepool = 1;
-
- a = autocvar_crosshair_ring_nex_inner_alpha;
- rgb = eX * autocvar_crosshair_ring_nex_inner_color_red + eY * autocvar_crosshair_ring_nex_inner_color_green + eZ * autocvar_crosshair_ring_nex_inner_color_blue;
- DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring_inner.tga", nex_chargepool, rgb, wcross_alpha * a, DRAWFLAG_ADDITIVE);
+ if (nex_chargepool || use_nex_chargepool) {
+ use_nex_chargepool = 1;
+ ring_inner_value = nex_chargepool;
+ } else {
+ nex_charge_movingavg = (1 - autocvar_crosshair_ring_nex_currentcharge_movingavg_rate) * nex_charge_movingavg + autocvar_crosshair_ring_nex_currentcharge_movingavg_rate * nex_charge;
+ ring_inner_value = bound(0, autocvar_crosshair_ring_nex_currentcharge_scale * (nex_charge - nex_charge_movingavg), 1);
+ }
+
+ ring_inner_alpha = wcross_alpha * autocvar_crosshair_ring_nex_inner_alpha;
+ ring_inner_image = "gfx/crosshair_ring_inner.tga";
+ ring_inner_rgb = eX * autocvar_crosshair_ring_nex_inner_color_red + eY * autocvar_crosshair_ring_nex_inner_color_green + eZ * autocvar_crosshair_ring_nex_inner_color_blue;
+
+ // draw the outer ring to show the current charge of the weapon
+ ring_value = nex_charge;
+ ring_alpha = wcross_alpha * autocvar_crosshair_ring_nex_alpha;
+ ring_image = "gfx/crosshair_ring_nexgun.tga";
+ ring_rgb = wcross_color;
}
- else
+ else if (activeweapon == WEP_MINE_LAYER && autocvar_crosshair_ring_minelayer)
{
- // indicate how much we're charging right now with an inner circle
- a = autocvar_crosshair_ring_nex_inner_alpha;
- nex_charge_movingavg = (1 - autocvar_crosshair_ring_nex_currentcharge_movingavg_rate) * nex_charge_movingavg + autocvar_crosshair_ring_nex_currentcharge_movingavg_rate * nex_charge;
-
- rgb = eX * autocvar_crosshair_ring_nex_inner_color_red + eY * autocvar_crosshair_ring_nex_inner_color_green + eZ * autocvar_crosshair_ring_nex_inner_color_blue;
- DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring_inner.tga", bound(0, autocvar_crosshair_ring_nex_currentcharge_scale * (nex_charge - nex_charge_movingavg), 1), rgb, wcross_alpha * a, DRAWFLAG_ADDITIVE);
+ ring_value = bound(0, getstati(STAT_LAYED_MINES) / 3, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
+ ring_alpha = wcross_alpha * autocvar_crosshair_ring_minelayer_alpha;
+ ring_image = "gfx/crosshair_ring.tga";
+ ring_rgb = wcross_color;
}
-
- // draw the charge
- a = autocvar_crosshair_ring_nex_outer_alpha;
- DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring_nexgun.tga", nex_charge, wcross_color, wcross_alpha * a, DRAWFLAG_ADDITIVE);
+
+ if (autocvar_crosshair_ring_inner && ring_inner_value) // lets draw a ring inside a ring so you can ring while you ring
+ DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, ring_inner_image, ring_inner_value, ring_inner_rgb, ring_inner_alpha, DRAWFLAG_ADDITIVE);
+
+ if (ring_value)
+ DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, ring_image, ring_value, ring_rgb, ring_alpha, DRAWFLAG_ADDITIVE);
}
#define CROSSHAIR_DO_BLUR(M,sz,wcross_name,wcross_alpha) \
float autocvar_crosshair_per_weapon;
float autocvar_crosshair_pickup;
float autocvar_crosshair_pickup_speed;
-float autocvar_crosshair_ring_sniperrifle_alpha;
+float autocvar_crosshair_ring;
+float autocvar_crosshair_ring_inner;
+float autocvar_crosshair_ring_minelayer;
+float autocvar_crosshair_ring_minelayer_alpha;
+float autocvar_crosshair_ring_nex;
+float autocvar_crosshair_ring_nex_alpha;
float autocvar_crosshair_ring_nex_currentcharge_movingavg_rate;
float autocvar_crosshair_ring_nex_currentcharge_scale;
float autocvar_crosshair_ring_nex_inner_alpha;
float autocvar_crosshair_ring_nex_inner_color_blue;
float autocvar_crosshair_ring_nex_inner_color_green;
float autocvar_crosshair_ring_nex_inner_color_red;
-float autocvar_crosshair_ring_nex_outer_alpha;
float autocvar_crosshair_ring_size;
+float autocvar_crosshair_ring_sniperrifle;
+float autocvar_crosshair_ring_sniperrifle_alpha;
float autocvar_crosshair_size;
float autocvar_ekg;
float autocvar_fov;
#else
#ifdef SVQC
void W_Mine_Think (void);
-.float minelayer_detonate, minelayer_mines;
+.float minelayer_detonate, mine_explodeanyway;
.float mine_time;
void spawnfunc_weapon_minelayer (void)
self.owner.switchweapon = w_getbestweapon(self.owner);
}
}
+ self.owner.minelayer_mines -= 1;
remove (self);
}
self.owner.switchweapon = w_getbestweapon(self.owner);
}
}
+ self.owner.minelayer_mines -= 1;
remove (self);
}
void W_Mine_ProximityExplode ()
{
// make sure no friend is in the mine's radius. If there is any, explosion is delayed until he's at a safe distance
- if(autocvar_g_balance_minelayer_protection && self.minelayer_mines == 0)
+ if(autocvar_g_balance_minelayer_protection && self.mine_explodeanyway == 0)
{
entity head;
head = findradius(self.origin, autocvar_g_balance_minelayer_radius);
W_Mine_Explode();
}
+float W_Mine_Count(entity e)
+{
+ float minecount;
+ entity mine;
+ for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == e)
+ minecount += 1;
+
+ return minecount;
+}
+
void W_Mine_Think (void)
{
entity head;
if(autocvar_g_balance_minelayer_lifetime_countdown > 0)
spamsound (self, CHAN_PROJECTILE, "weapons/mine_trigger.wav", VOL_BASE, ATTN_NORM);
self.mine_time = time + autocvar_g_balance_minelayer_lifetime_countdown;
- self.minelayer_mines = 1; // make the mine super aggressive
+ self.mine_explodeanyway = 1; // make the mine super aggressive -- Samual: Rather, make it not care if a team mate is near.
}
// a player's mines shall explode if he disconnects or dies
// scan how many mines we placed, and return if we reached our limit
if(autocvar_g_balance_minelayer_limit)
{
- self.minelayer_mines = 0;
- for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
- self.minelayer_mines += 1;
-
- if(self.minelayer_mines >= autocvar_g_balance_minelayer_limit)
+
+ if(W_Mine_Count(self) >= autocvar_g_balance_minelayer_limit)
{
// the refire delay keeps this message from being spammed
sprint(self, strcat("You cannot place more than ^2", ftos(autocvar_g_balance_minelayer_limit), " ^7mines at a time\n") );
// common properties
other = mine; MUTATOR_CALLHOOK(EditProjectile);
+
+ self.minelayer_mines = W_Mine_Count(self);
}
void spawnfunc_weapon_minelayer (void); // defined in t_items.qc