From: Mircea Kitsune Date: Wed, 2 Mar 2011 22:19:06 +0000 (+0200) Subject: Merge branch 'master' into mirceakitsune/universal_reload_system, with some VERY... X-Git-Tag: xonotic-v0.5.0~309^2~7^2~10 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f2671ce82866c2468c1fa315101d30f91af2adbb;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into mirceakitsune/universal_reload_system, with some VERY conflicting changes. This is why I have waiting a long time for a branch to get merged in master. --- f2671ce82866c2468c1fa315101d30f91af2adbb diff --cc qcsrc/client/Defs.qc index eef29cdd5,99c8d5c2b..b3b056948 --- a/qcsrc/client/Defs.qc +++ b/qcsrc/client/Defs.qc @@@ -261,6 -261,10 +261,8 @@@ vector w_org, w_backoff float sniperrifle_scope; float nex_scope; -float cr_maxbullets; - + float minelayer_maxmines; + float bgmtime; string weaponorder_byimpulse; diff --cc qcsrc/client/Main.qc index 125c6db31,f24b483d6..bec75c2ee --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@@ -1094,6 -1094,10 +1094,8 @@@ void Ent_Init( serverflags = ReadByte(); - cr_maxbullets = ReadByte(); - + minelayer_maxmines = ReadByte(); + g_trueaim_minrange = ReadCoord(); if(!postinit) diff --cc qcsrc/client/View.qc index 62ab6b682,6746cfe6b..e95a01346 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@@ -866,7 -866,6 +866,9 @@@ void CSQC_UpdateView(float w, float h // TrueAim check float shottype; ++ + float weapon_clipload, weapon_clipsize, 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; @@@ -1064,51 -1063,63 +1066,68 @@@ 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 ammo left in weapon clip - weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD); - if (weapon_clipload) + if (autocvar_crosshair_ring) { - weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE); - f = bound(0, weapon_clipload / weapon_clipsize, 1); + 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; + - a = autocvar_crosshair_ring_sniperrifle_alpha; - DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring.tga", f, wcross_color, wcross_alpha * a, DRAWFLAG_ADDITIVE); - } - if (activeweapon == WEP_NEX && nex_charge) // ring around crosshair representing velocity-dependent damage for the nex - { - if(nex_chargepool || use_nex_chargepool) ++ weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD); ++ if (weapon_clipload) // ring around crosshair representing ammo left in weapon clip + { - 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); ++ weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE); ++ f = bound(0, weapon_clipload / weapon_clipsize, 1); ++ a = autocvar_crosshair_ring_sniperrifle_alpha; ++ ++ ring_value = f; ++ ring_alpha = a; + ring_image = "gfx/crosshair_ring_sniperrifle.tga"; + ring_rgb = wcross_color; } - else + else if (activeweapon == WEP_NEX && nex_charge && autocvar_crosshair_ring_nex) // ring around crosshair representing velocity-dependent damage for the nex { - // 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); + 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; } - - // draw the charge - a = autocvar_crosshair_ring_nex_outer_alpha; - DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring.tga", nex_charge, wcross_color, wcross_alpha * a, DRAWFLAG_ADDITIVE); + else if (activeweapon == WEP_MINE_LAYER && minelayer_maxmines && autocvar_crosshair_ring_minelayer) + { + ring_value = bound(0, getstati(STAT_LAYED_MINES) / minelayer_maxmines, 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; + } + + 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) \ diff --cc qcsrc/common/constants.qh index b8c4f4469,d5df6586c..419ab73e8 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@@ -62,6 -62,8 +62,7 @@@ const float TE_CSQC_TARGET_MUSIC = 111 const float TE_CSQC_NOTIFY = 112; const float TE_CSQC_WEAPONCOMPLAIN = 113; const float TE_CSQC_NEX_SCOPE = 116; -const float TE_CSQC_CR_MAXBULLETS = 117; -const float TE_CSQC_MINELAYER_MAXMINES = 118; ++const float TE_CSQC_MINELAYER_MAXMINES = 117; const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder const float RACE_NET_CHECKPOINT_CLEAR = 1; @@@ -307,14 -309,14 +308,15 @@@ const float STAT_FUEL = 44 const float STAT_NB_METERSTART = 45; const float STAT_SHOTORG = 46; // compressShotOrigin const float STAT_LEADLIMIT = 47; -const float STAT_BULLETS_LOADED = 48; -const float STAT_NEX_CHARGE = 49; -const float STAT_LAST_PICKUP = 50; -const float STAT_HUD = 51; -const float STAT_NEX_CHARGEPOOL = 52; -const float STAT_HIT_TIME = 53; -const float STAT_TYPEHIT_TIME = 54; -const float STAT_LAYED_MINES = 55; +const float STAT_WEAPON_CLIPLOAD = 48; +const float STAT_WEAPON_CLIPSIZE = 49; +const float STAT_NEX_CHARGE = 50; +const float STAT_LAST_PICKUP = 51; +const float STAT_HUD = 52; +const float STAT_NEX_CHARGEPOOL = 53; +const float STAT_HIT_TIME = 54; +const float STAT_TYPEHIT_TIME = 55; ++const float STAT_LAYED_MINES = 56; // see DP source, quakedef.h const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222; diff --cc qcsrc/server/cl_client.qc index c5312469a,6247aaf1f..1b10b6e25 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@@ -1115,6 -1109,8 +1115,7 @@@ float ClientInit_SendEntity(entity to, WriteByte(MSG_ENTITY, autocvar_g_balance_nex_secondary); // client has to know if it should zoom or not WriteByte(MSG_ENTITY, autocvar_g_balance_sniperrifle_secondary); // client has to know if it should zoom or not WriteByte(MSG_ENTITY, serverflags); // client has to know if it should zoom or not - WriteByte(MSG_ENTITY, autocvar_g_balance_sniperrifle_magazinecapacity); // rifle max bullets + WriteByte(MSG_ENTITY, autocvar_g_balance_minelayer_limit); // minelayer max mines WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange); return TRUE; } @@@ -2361,6 -2355,10 +2362,9 @@@ void SpectateCopy(entity spectatee) self.weapons = spectatee.weapons; self.switchweapon = spectatee.switchweapon; self.weapon = spectatee.weapon; + self.nex_charge = spectatee.nex_charge; + self.nex_chargepool_ammo = spectatee.nex_chargepool_ammo; - self.sniperrifle_bulletcounter = spectatee.sniperrifle_bulletcounter; + self.minelayer_mines = spectatee.minelayer_mines; self.punchangle = spectatee.punchangle; self.view_ofs = spectatee.view_ofs; self.v_angle = spectatee.v_angle; diff --cc qcsrc/server/defs.qh index 39eebe7fb,d008f15d9..ff6658d29 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@@ -611,13 -611,9 +611,14 @@@ float client_cefc_accumulator float client_cefc_accumulatortime; #endif +..float current_ammo; + +.float weapon_load[WEP_MAXCOUNT]; FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(weapon_load); +.float ammo_none; // used by the reloading system, must always be 0 +.float clip_load; +.float old_clip_load; +.float clip_size; + .float minelayer_mines; -.float sniperrifle_bulletcounter; -.float wish_reload; #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE // when doing this, hagar can go through clones