Merge branch 'master' into Lyberta/StandaloneOverkillWeapons
authorLyberta <lyberta@lyberta.net>
Fri, 16 Feb 2018 08:39:22 +0000 (11:39 +0300)
committerLyberta <lyberta@lyberta.net>
Fri, 16 Feb 2018 08:39:22 +0000 (11:39 +0300)
1  2 
qcsrc/client/view.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/wepent.qc
qcsrc/common/wepent.qh
qcsrc/server/client.qc
qcsrc/server/defs.qh

@@@ -1193,34 -1191,27 +1193,29 @@@ void HUD_Crosshair(entity this
  
                                ring_scale = autocvar_crosshair_ring_size;
  
-                               float weapon_clipload, weapon_clipsize;
-                               weapon_clipload = STAT(WEAPON_CLIPLOAD);
-                               weapon_clipsize = STAT(WEAPON_CLIPSIZE);
-                               float vortex_charge, vortex_chargepool;
-                               vortex_charge = STAT(VORTEX_CHARGE);
-                               vortex_chargepool = STAT(VORTEX_CHARGEPOOL);
+                               entity wepent = viewmodels[0]; // TODO: unhardcode
  
-                               float oknex_charge, oknex_chargepool;
-                               oknex_charge = STAT(OVERKILL_NEX_CHARGE);
-                               oknex_chargepool = STAT(OVERKILL_NEX_CHARGEPOOL);
+                               int weapon_clipload = wepent.clip_load;
+                               int weapon_clipsize = wepent.clip_size;
  
-                               float arc_heat = STAT(ARC_HEAT);
+                               float arc_heat = wepent.arc_heat_percent;
+                               float vcharge = wepent.vortex_charge;
+                               float vchargepool = wepent.vortex_chargepool_ammo;
++                              float oknex_charge_ = wepent.oknex_charge;
++                              float oknex_chargepool_ = wepent.oknex_chargepool_ammo;
  
                                if(vortex_charge_movingavg == 0) // this should only happen if we have just loaded up the game
-                                       vortex_charge_movingavg = vortex_charge;
-                               entity wepent = viewmodels[0]; // TODO: unhardcode
+                                       vortex_charge_movingavg = vcharge;
  
                                // handle the values
-                               if (autocvar_crosshair_ring && wepent.activeweapon == WEP_VORTEX && vortex_charge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
+                               if (autocvar_crosshair_ring && wepent.activeweapon == WEP_VORTEX && vcharge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
                                {
-                                       if (vortex_chargepool || use_vortex_chargepool) {
+                                       if (vchargepool || use_vortex_chargepool) {
                                                use_vortex_chargepool = 1;
-                                               ring_inner_value = vortex_chargepool;
+                                               ring_inner_value = vchargepool;
                                        } else {
-                                               vortex_charge_movingavg = (1 - autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate) * vortex_charge_movingavg + autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate * vortex_charge;
-                                               ring_inner_value = bound(0, autocvar_crosshair_ring_vortex_currentcharge_scale * (vortex_charge - vortex_charge_movingavg), 1);
+                                               vortex_charge_movingavg = (1 - autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate) * vortex_charge_movingavg + autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate * vcharge;
+                                               ring_inner_value = bound(0, autocvar_crosshair_ring_vortex_currentcharge_scale * (vcharge - vortex_charge_movingavg), 1);
                                        }
  
                                        ring_inner_alpha = autocvar_crosshair_ring_vortex_inner_alpha;
                                        ring_rgb = wcross_color;
                                        ring_image = "gfx/crosshair_ring_nexgun.tga";
                                }
 +                              else if (autocvar_crosshair_ring && (wepent.activeweapon == WEP_OVERKILL_NEX) && oknex_charge && autocvar_crosshair_ring_vortex)
 +                              {
 +                                      if (oknex_chargepool || use_vortex_chargepool) {
 +                                              use_vortex_chargepool = 1;
 +                                              ring_inner_value = oknex_chargepool;
 +                                      } else {
 +                                              vortex_charge_movingavg = (1 - autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate) * vortex_charge_movingavg + autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate * oknex_charge;
 +                                              ring_inner_value = bound(0, autocvar_crosshair_ring_vortex_currentcharge_scale * (oknex_charge - vortex_charge_movingavg), 1);
 +                                      }
 +
 +                                      ring_inner_alpha = autocvar_crosshair_ring_vortex_inner_alpha;
 +                                      ring_inner_rgb = eX * autocvar_crosshair_ring_vortex_inner_color_red + eY * autocvar_crosshair_ring_vortex_inner_color_green + eZ * autocvar_crosshair_ring_vortex_inner_color_blue;
 +                                      ring_inner_image = "gfx/crosshair_ring_inner.tga";
 +
 +                                      // draw the outer ring to show the current charge of the weapon
 +                                      ring_value = oknex_charge;
 +                                      ring_alpha = autocvar_crosshair_ring_vortex_alpha;
 +                                      ring_rgb = wcross_color;
 +                                      ring_image = "gfx/crosshair_ring_nexgun.tga";
 +                              }
                                else if (autocvar_crosshair_ring && wepent.activeweapon == WEP_MINE_LAYER && WEP_CVAR(minelayer, limit) && autocvar_crosshair_ring_minelayer)
                                {
-                                       ring_value = bound(0, STAT(LAYED_MINES) / WEP_CVAR(minelayer, limit), 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_value = bound(0, wepent.minelayer_mines / WEP_CVAR(minelayer, limit), 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 = autocvar_crosshair_ring_minelayer_alpha;
                                        ring_rgb = wcross_color;
                                        ring_image = "gfx/crosshair_ring.tga";
@@@ -48,15 -48,15 +48,15 @@@ void W_RocketPropelledChainsaw_Think(en
                return;
        }
  
-       this.cnt = vlen(this.velocity);
-       this.wait = this.cnt * sys_frametime;
-       this.pos1 = normalize(this.velocity);
+       float myspeed = vlen(this.velocity);
+       float myspeed_accel = myspeed * sys_frametime;
+       vector mydir = normalize(this.velocity);
  
-       tracebox(this.origin, this.mins, this.maxs, this.origin + this.pos1 * (2 * this.wait), MOVE_NORMAL, this);
+       tracebox(this.origin, this.mins, this.maxs, this.origin + mydir * (2 * myspeed_accel), MOVE_NORMAL, this);
        if(IS_PLAYER(trace_ent))
 -              Damage (trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR(rpc, force));
 +              Damage (trace_ent, this, this.realowner, WEP_CVAR_PRI(rpc, damage2), this.projectiledeathtype, this.origin, normalize(this.origin - other.origin) * WEP_CVAR_PRI(rpc, force));
  
-       this.velocity = this.pos1 * (this.cnt + (WEP_CVAR_PRI(rpc, speedaccel) * sys_frametime));
 -      this.velocity = mydir * (myspeed + (WEP_CVAR(rpc, speedaccel) * sys_frametime));
++      this.velocity = mydir * (myspeed + (WEP_CVAR_PRI(rpc, speedaccel) * sys_frametime));
  
        UpdateCSQCProjectile(this);
        this.nextthink = time;
Simple merge
@@@ -4,8 -4,13 +4,15 @@@ REGISTER_NET_LINKED(ENT_CLIENT_WEPENT
  REGISTER_NET_TEMP(CLIENT_WEPENT)
  
  .float vortex_charge;
+ .float vortex_chargepool_ammo;
 +.float oknex_charge;
++.float oknex_chargepool_ammo;
  .int tuba_instrument;
+ .int minelayer_mines;
+ .float arc_heat_percent;
+ .int hagar_load;
+ .int clip_load;
+ .int clip_size;
  
  #ifdef SVQC
  
Simple merge
@@@ -324,18 -324,15 +324,18 @@@ float client_cefc_accumulatortime
  
  .float weapon_load[Weapons_MAX];
  .int ammo_none; // used by the reloading system, must always be 0
- .float clip_load = _STAT(WEAPON_CLIPLOAD);
+ .float clip_load;
  .float old_clip_load;
- .float clip_size = _STAT(WEAPON_CLIPSIZE);
+ .float clip_size;
  
- .float minelayer_mines = _STAT(LAYED_MINES);
- .float vortex_charge = _STAT(VORTEX_CHARGE);
+ .int minelayer_mines;
+ .float vortex_charge;
  .float vortex_charge_rottime;
- .float vortex_chargepool_ammo = _STAT(VORTEX_CHARGEPOOL);
- .float oknex_charge = _STAT(OVERKILL_NEX_CHARGE);
+ .float vortex_chargepool_ammo;
++.float oknex_charge;
 +.float oknex_charge_rottime;
- .float oknex_chargepool_ammo = _STAT(OVERKILL_NEX_CHARGEPOOL);
- .float hagar_load = _STAT(HAGAR_LOAD);
++.float oknex_chargepool_ammo;
+ .int hagar_load;
  
  .int grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab