From: Mario Date: Tue, 13 Feb 2018 00:30:13 +0000 (+1000) Subject: Port clip_load and clip_size to wepent X-Git-Tag: xonotic-v0.8.5~2313^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4225c1a6d7def2adec7a47263087797d259f8e04;p=xonotic%2Fxonotic-data.pk3dir.git Port clip_load and clip_size to wepent --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index cf7ca8087..7dcbd83d2 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1191,12 +1191,11 @@ 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); - entity wepent = viewmodels[0]; // TODO: unhardcode + int weapon_clipload = wepent.clip_load; + int weapon_clipsize = wepent.clip_size; + float arc_heat = wepent.arc_heat_percent; float vcharge = wepent.vortex_charge; float vchargepool = wepent.vortex_chargepool_ammo; diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index e3ff0b3d4..69d3a4f58 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -81,8 +81,6 @@ REGISTER_STAT(NB_METERSTART, float) /** compressShotOrigin */ REGISTER_STAT(SHOTORG, int) REGISTER_STAT(LEADLIMIT, float, autocvar_leadlimit) -REGISTER_STAT(WEAPON_CLIPLOAD, int) -REGISTER_STAT(WEAPON_CLIPSIZE, int) REGISTER_STAT(LAST_PICKUP, float) REGISTER_STAT(HUD, int) diff --git a/qcsrc/common/wepent.qc b/qcsrc/common/wepent.qc index 36ab27dfa..9335a4788 100644 --- a/qcsrc/common/wepent.qc +++ b/qcsrc/common/wepent.qc @@ -57,6 +57,14 @@ MACRO_END PROP(false, vortex_chargepool_ammo, WEPENT_SET_NORMAL, \ { WriteByte(chan, this.vortex_chargepool_ammo * 16); }, \ { (viewmodels[this.m_wepent_slot]).vortex_chargepool_ammo = ReadByte() / 16; }) \ + \ + PROP(false, clip_load, WEPENT_SET_NORMAL, \ + { WriteShort(chan, this.clip_load); }, \ + { (viewmodels[this.m_wepent_slot]).clip_load = ReadShort(); }) \ + \ + PROP(false, clip_size, WEPENT_SET_NORMAL, \ + { WriteShort(chan, this.clip_size); }, \ + { (viewmodels[this.m_wepent_slot]).clip_size = ReadShort(); }) \ \ /**/ diff --git a/qcsrc/common/wepent.qh b/qcsrc/common/wepent.qh index ad2bba02e..dbd38fc10 100644 --- a/qcsrc/common/wepent.qh +++ b/qcsrc/common/wepent.qh @@ -9,6 +9,8 @@ REGISTER_NET_TEMP(CLIENT_WEPENT) .int minelayer_mines; .float arc_heat_percent; .int hagar_load; +.int clip_load; +.int clip_size; #ifdef SVQC diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 7dc26025e..38869cea4 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1763,8 +1763,6 @@ void SpectateCopy(entity this, entity spectatee) this.ammo_nails = spectatee.ammo_nails; this.ammo_rockets = spectatee.ammo_rockets; this.ammo_fuel = spectatee.ammo_fuel; - this.clip_load = spectatee.clip_load; - this.clip_size = spectatee.clip_size; this.effects = spectatee.effects & EFMASK_CHEAP; // eat performance this.health = spectatee.health; CS(this).impulse = 0; @@ -2289,12 +2287,6 @@ bool PlayerThink(entity this) { .entity weaponentity = weaponentities[slot]; W_WeaponFrame(this, weaponentity); - - if(slot == 0) - { - this.clip_load = this.(weaponentity).clip_load; - this.clip_size = this.(weaponentity).clip_size; - } } this.items_added = 0; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 52f269845..577753a50 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -324,9 +324,9 @@ 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; .int minelayer_mines; .float vortex_charge;