From: TimePath Date: Sun, 28 Feb 2016 05:04:32 +0000 (+0000) Subject: Merge branch 'proraide/fix_fps' into 'master' X-Git-Tag: xonotic-v0.8.2~1172 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=673e10309b9783b5fb64b76f0e65a93071a7ef6a;hp=337be31755891b541def881c34fbf8fc49473184;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'proraide/fix_fps' into 'master' Regain ~10 fps commit 5a935f5c767deb9151a2e7b4f2bc190766190ab7 moved drawfill() after if() as far as I can tell it's unnecessary and putting it back into if-else restores 10 fps in my tests See merge request !287 --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 291548800..613f231ea 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,7 @@ test_sv_game: script: - wget -O data/g-23.pk3 http://beta.xonotic.org/autobuild-bsp/latest/g-23.pk3 - make - - EXPECT=4c308ac459a47a3641c8a1934d13667c + - EXPECT=f75e1bf926a9d7bfe27765f5cf8cef20 - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg | tee /dev/stderr | grep '^:' diff --git a/bal-wep-xonotic.cfg b/bal-wep-xonotic.cfg index 07005ccc3..7cb9d9f4c 100644 --- a/bal-wep-xonotic.cfg +++ b/bal-wep-xonotic.cfg @@ -219,7 +219,7 @@ set g_balance_electro_secondary_speed 1000 set g_balance_electro_secondary_speed_up 200 set g_balance_electro_secondary_speed_z 0 set g_balance_electro_secondary_spread 0.04 -set g_balance_electro_secondary_touchexplode 0 +set g_balance_electro_secondary_touchexplode 1 set g_balance_electro_switchdelay_drop 0.2 set g_balance_electro_switchdelay_raise 0.2 set g_balance_electro_weaponreplace "" @@ -242,7 +242,7 @@ set g_balance_crylink_primary_joinexplode_edgedamage 0 set g_balance_crylink_primary_joinexplode_force 0 set g_balance_crylink_primary_joinexplode_radius 0 set g_balance_crylink_primary_joinspread 0.2 -set g_balance_crylink_primary_linkexplode 1 +set g_balance_crylink_primary_linkexplode 0 set g_balance_crylink_primary_middle_fadetime 5 set g_balance_crylink_primary_middle_lifetime 5 set g_balance_crylink_primary_other_fadetime 5 @@ -725,7 +725,7 @@ set g_balance_shockwave_weaponstartoverride -1 set g_balance_shockwave_weaponthrowable 0 // }}} // {{{ #20: Arc -set g_balance_arc_beam_ammo 4 +set g_balance_arc_beam_ammo 6 set g_balance_arc_beam_animtime 0.2 set g_balance_arc_beam_botaimlifetime 0 set g_balance_arc_beam_botaimspeed 0 @@ -736,20 +736,20 @@ set g_balance_arc_beam_falloff_halflifedist 0 set g_balance_arc_beam_falloff_maxdist 0 set g_balance_arc_beam_falloff_mindist 0 set g_balance_arc_beam_force 900 -set g_balance_arc_beam_healing_amax 100 +set g_balance_arc_beam_healing_amax 0 set g_balance_arc_beam_healing_aps 50 set g_balance_arc_beam_healing_hmax 150 set g_balance_arc_beam_healing_hps 50 set g_balance_arc_cooldown 2.5 -set g_balance_arc_cooldown_release 1 +set g_balance_arc_cooldown_release 0 set g_balance_arc_overheat_max 5 set g_balance_arc_overheat_min 3 -set g_balance_arc_beam_heat 1 +set g_balance_arc_beam_heat 0.75 set g_balance_arc_burst_heat 4 set g_balance_arc_beam_maxangle 10 set g_balance_arc_beam_nonplayerdamage 80 set g_balance_arc_beam_range 1000 -set g_balance_arc_beam_refire 0.5 +set g_balance_arc_beam_refire 0.25 set g_balance_arc_beam_returnspeed 8 set g_balance_arc_beam_tightness 0.5 set g_balance_arc_bolt 0 @@ -757,19 +757,19 @@ set g_balance_arc_bolt_ammo 1 set g_balance_arc_bolt_damage 25 set g_balance_arc_bolt_damageforcescale 0 set g_balance_arc_bolt_edgedamage 12.5 -set g_balance_arc_bolt_force 100 +set g_balance_arc_bolt_force 120 set g_balance_arc_bolt_health 15 set g_balance_arc_bolt_lifetime 5 set g_balance_arc_bolt_radius 65 set g_balance_arc_bolt_refire 0.16667 set g_balance_arc_bolt_speed 2200 -set g_balance_arc_bolt_spread 0.03 +set g_balance_arc_bolt_spread 0 set g_balance_arc_burst_ammo 15 set g_balance_arc_burst_damage 250 set g_balance_arc_burst_healing_aps 100 set g_balance_arc_burst_healing_hps 100 -set g_balance_arc_switchdelay_drop 0.3 -set g_balance_arc_switchdelay_raise 0.3 +set g_balance_arc_switchdelay_drop 0.2 +set g_balance_arc_switchdelay_raise 0.2 set g_balance_arc_weaponreplace "" set g_balance_arc_weaponstart 0 set g_balance_arc_weaponstartoverride -1 diff --git a/bal-wep-xpm.cfg b/bal-wep-xpm.cfg index 07005ccc3..7cb9d9f4c 100644 --- a/bal-wep-xpm.cfg +++ b/bal-wep-xpm.cfg @@ -219,7 +219,7 @@ set g_balance_electro_secondary_speed 1000 set g_balance_electro_secondary_speed_up 200 set g_balance_electro_secondary_speed_z 0 set g_balance_electro_secondary_spread 0.04 -set g_balance_electro_secondary_touchexplode 0 +set g_balance_electro_secondary_touchexplode 1 set g_balance_electro_switchdelay_drop 0.2 set g_balance_electro_switchdelay_raise 0.2 set g_balance_electro_weaponreplace "" @@ -242,7 +242,7 @@ set g_balance_crylink_primary_joinexplode_edgedamage 0 set g_balance_crylink_primary_joinexplode_force 0 set g_balance_crylink_primary_joinexplode_radius 0 set g_balance_crylink_primary_joinspread 0.2 -set g_balance_crylink_primary_linkexplode 1 +set g_balance_crylink_primary_linkexplode 0 set g_balance_crylink_primary_middle_fadetime 5 set g_balance_crylink_primary_middle_lifetime 5 set g_balance_crylink_primary_other_fadetime 5 @@ -725,7 +725,7 @@ set g_balance_shockwave_weaponstartoverride -1 set g_balance_shockwave_weaponthrowable 0 // }}} // {{{ #20: Arc -set g_balance_arc_beam_ammo 4 +set g_balance_arc_beam_ammo 6 set g_balance_arc_beam_animtime 0.2 set g_balance_arc_beam_botaimlifetime 0 set g_balance_arc_beam_botaimspeed 0 @@ -736,20 +736,20 @@ set g_balance_arc_beam_falloff_halflifedist 0 set g_balance_arc_beam_falloff_maxdist 0 set g_balance_arc_beam_falloff_mindist 0 set g_balance_arc_beam_force 900 -set g_balance_arc_beam_healing_amax 100 +set g_balance_arc_beam_healing_amax 0 set g_balance_arc_beam_healing_aps 50 set g_balance_arc_beam_healing_hmax 150 set g_balance_arc_beam_healing_hps 50 set g_balance_arc_cooldown 2.5 -set g_balance_arc_cooldown_release 1 +set g_balance_arc_cooldown_release 0 set g_balance_arc_overheat_max 5 set g_balance_arc_overheat_min 3 -set g_balance_arc_beam_heat 1 +set g_balance_arc_beam_heat 0.75 set g_balance_arc_burst_heat 4 set g_balance_arc_beam_maxangle 10 set g_balance_arc_beam_nonplayerdamage 80 set g_balance_arc_beam_range 1000 -set g_balance_arc_beam_refire 0.5 +set g_balance_arc_beam_refire 0.25 set g_balance_arc_beam_returnspeed 8 set g_balance_arc_beam_tightness 0.5 set g_balance_arc_bolt 0 @@ -757,19 +757,19 @@ set g_balance_arc_bolt_ammo 1 set g_balance_arc_bolt_damage 25 set g_balance_arc_bolt_damageforcescale 0 set g_balance_arc_bolt_edgedamage 12.5 -set g_balance_arc_bolt_force 100 +set g_balance_arc_bolt_force 120 set g_balance_arc_bolt_health 15 set g_balance_arc_bolt_lifetime 5 set g_balance_arc_bolt_radius 65 set g_balance_arc_bolt_refire 0.16667 set g_balance_arc_bolt_speed 2200 -set g_balance_arc_bolt_spread 0.03 +set g_balance_arc_bolt_spread 0 set g_balance_arc_burst_ammo 15 set g_balance_arc_burst_damage 250 set g_balance_arc_burst_healing_aps 100 set g_balance_arc_burst_healing_hps 100 -set g_balance_arc_switchdelay_drop 0.3 -set g_balance_arc_switchdelay_raise 0.3 +set g_balance_arc_switchdelay_drop 0.2 +set g_balance_arc_switchdelay_raise 0.2 set g_balance_arc_weaponreplace "" set g_balance_arc_weaponstart 0 set g_balance_arc_weaponstartoverride -1 diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 7bc9466eb..50e0ad7e7 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -163,28 +163,21 @@ cl_bobmodel 1 // whether to have gun model move around on screen when moving (on cl_bobmodel_side 0.2 // amount the gun sways to the sides cl_bobmodel_speed 5 // rate at which the gun sways cl_bobmodel_up 0.1 // amount the gun sways up and down -cl_leanmodel 1 // enables weapon leaning effect when looking around -cl_leanmodel_side_speed 0.7 "gun leaning sideways speed" -cl_leanmodel_side_limit 35 "gun leaning sideways limit" -cl_leanmodel_side_highpass1 30 "gun leaning sideways pre-highpass in 1/s" -cl_leanmodel_side_highpass 3 "gun leaning sideways highpass in 1/s" -cl_leanmodel_side_lowpass 20 "gun leaning sideways lowpass in 1/s" -cl_leanmodel_up_speed 0.65 "gun leaning upward speed" -cl_leanmodel_up_limit 50 "gun leaning upward limit" -cl_leanmodel_up_highpass1 5 "gun leaning upward pre-highpass in 1/s" -cl_leanmodel_up_highpass 15 "gun leaning upward highpass in 1/s" -cl_leanmodel_up_lowpass 20 "gun leaning upward lowpass in 1/s" + cl_followmodel 1 // enables weapon pushing / pulling effect when walking -cl_followmodel_side_speed 0.25 "gun following sideways speed" -cl_followmodel_side_limit 6 "gun following sideways limit" -cl_followmodel_side_highpass1 30 "gun following sideways pre-highpass in 1/s" -cl_followmodel_side_highpass 5 "gun following sideways highpass in 1/s" -cl_followmodel_side_lowpass 10 "gun following sideways lowpass in 1/s" -cl_followmodel_up_speed 0.5 "gun following upward speed" -cl_followmodel_up_limit 5 "gun following upward limit" -cl_followmodel_up_highpass1 60 "gun following upward pre-highpass in 1/s" -cl_followmodel_up_highpass 2 "gun following upward highpass in 1/s" -cl_followmodel_up_lowpass 10 "gun following upward lowpass in 1/s" +seta cl_followmodel_speed 0.3 "gun following speed" +seta cl_followmodel_limit 1000 "gun following limit" +seta cl_followmodel_velocity_absolute 0 "make the effect ignore velocity direction changes (side effect: it causes a glitch when teleporting / passing through a warpzone)" +seta cl_followmodel_velocity_lowpass 0.05 "gun following velocity lowpass averaging time" +seta cl_followmodel_highpass 0.05 "gun following highpass averaging time" +seta cl_followmodel_lowpass 0.03 "gun following lowpass averaging time" + +cl_leanmodel 1 // enables weapon leaning effect when looking around +seta cl_leanmodel_speed 0.3 "gun leaning speed" +seta cl_leanmodel_limit 1000 "gun leaning limit" +seta cl_leanmodel_highpass1 0.2 "gun leaning pre-highpass averaging time" +seta cl_leanmodel_highpass 0.2 "gun leaning highpass averaging time" +seta cl_leanmodel_lowpass 0.05 "gun leaning lowpass averaging time" cl_rollangle 0 // amount of view tilt when strafing, default is 2.0 v_kicktime 0 // how long damage kicks of the view last, default is 0 seconds diff --git a/models/weapons/g_campingrifle.md3 b/models/weapons/g_campingrifle.md3 index 594e706f8..fd829833e 100644 Binary files a/models/weapons/g_campingrifle.md3 and b/models/weapons/g_campingrifle.md3 differ diff --git a/models/weapons/g_hagar.md3 b/models/weapons/g_hagar.md3 index 6e21ba9f8..2047627bf 100644 Binary files a/models/weapons/g_hagar.md3 and b/models/weapons/g_hagar.md3 differ diff --git a/models/weapons/h_hagar.iqm b/models/weapons/h_hagar.iqm index a51c6c4f5..fe87dac03 100644 Binary files a/models/weapons/h_hagar.iqm and b/models/weapons/h_hagar.iqm differ diff --git a/models/weapons/h_hagar.iqm.framegroups b/models/weapons/h_hagar.iqm.framegroups index 0a59625b6..e02cf0f64 100644 --- a/models/weapons/h_hagar.iqm.framegroups +++ b/models/weapons/h_hagar.iqm.framegroups @@ -1,4 +1,9 @@ -1 8 20 0 // fire -9 5 20 0 // fire2 -15 200 20 1 // idle -215 40 20 0 // reload +/* +Generated framegroups file for h_hagar +Used by DarkPlaces to simulate frame groups in DPM models. +*/ + +1 11 15 1 // h_hagar fire +12 9 60 1 // h_hagar fire2 +21 51 5 1 // h_hagar idle +72 21 30 1 // h_hagar reload diff --git a/models/weapons/v_campingrifle.md3 b/models/weapons/v_campingrifle.md3 index 251e79f75..e9990ebc3 100644 Binary files a/models/weapons/v_campingrifle.md3 and b/models/weapons/v_campingrifle.md3 differ diff --git a/models/weapons/v_hagar.md3 b/models/weapons/v_hagar.md3 index 19a245343..f1f08b010 100644 Binary files a/models/weapons/v_hagar.md3 and b/models/weapons/v_hagar.md3 differ diff --git a/monsters.cfg b/monsters.cfg index 2cb6c3e7d..f6eca00d0 100644 --- a/monsters.cfg +++ b/monsters.cfg @@ -20,7 +20,7 @@ set g_monster_spider_attack_web_speed 1300 set g_monster_spider_attack_web_speed_up 150 set g_monster_spider_damageforcescale 0.600000024 set g_monster_spider_health 180 -set g_monster_spider_speed_run 750 +set g_monster_spider_speed_run 500 set g_monster_spider_speed_stop 100 set g_monster_spider_speed_walk 400 // }}} diff --git a/mutators.cfg b/mutators.cfg index dd8d96a56..894caec14 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -182,6 +182,8 @@ set g_nades 0 "enable off-hand grenades" set g_nades_throw_offset "0 0 0" "nade throwing offset" set g_nades_spawn 1 "give nades right away when player spawns rather than delaying entire refire" set g_nades_client_select 0 "allow client side selection of nade type" +set g_nades_pickup 1 "allow picking up thrown nades (not your own)" +set g_nades_pickup_time 2 "time until picked up nade explodes" set g_nades_nade_lifetime 3.5 set g_nades_nade_minforce 400 set g_nades_nade_maxforce 2000 @@ -214,6 +216,7 @@ set g_nades_bonus_type 2 "Type of the bonus grenade. 1:normal 2:napalm 3:ice 4:t set g_nades_bonus_onstrength 1 "Always give bonus grenades to players that have the strength powerup" set g_nades_bonus_max 3 "Maximum number of bonus grenades" set g_nades_bonus_only 0 "Disallow regular nades, only bonus nades can be used" +set g_nades_nade_small 0 "Use smaller nade size, makes shooting them harder, legacy setting" // Bonus score set g_nades_bonus_score_max 120 "Score value that will give a bonus nade" set g_nades_bonus_score_minor 5 "Score given for minor actions (pickups, regular frags etc.)" diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index aa490aa50..14279816e 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -202,6 +202,8 @@ void Shutdown() if(autocvar_chase_active < 0) cvar_set("chase_active", "0"); + cvar_set("slowmo", cvar_defstring("slowmo")); // reset it back to 'default' + if (!isdemo()) { if (!(calledhooks & HOOK_START)) diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index b6b5c9cd0..d7207fc6f 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -39,33 +39,23 @@ float autocvar_cl_bobmodel_side; float autocvar_cl_bobmodel_up; float autocvar_cl_followmodel; -float autocvar_cl_followmodel_side_speed; -float autocvar_cl_followmodel_side_highpass; -float autocvar_cl_followmodel_side_highpass1; -float autocvar_cl_followmodel_side_limit; -float autocvar_cl_followmodel_side_lowpass; -float autocvar_cl_followmodel_up_speed; -float autocvar_cl_followmodel_up_highpass; -float autocvar_cl_followmodel_up_highpass1; -float autocvar_cl_followmodel_up_limit; -float autocvar_cl_followmodel_up_lowpass; +float autocvar_cl_followmodel_speed = 0.3; +float autocvar_cl_followmodel_limit = 1000; +float autocvar_cl_followmodel_velocity_lowpass = 0.05; +float autocvar_cl_followmodel_highpass = 0.05; +float autocvar_cl_followmodel_lowpass = 0.03; float autocvar_cl_leanmodel; -float autocvar_cl_leanmodel_side_speed; -float autocvar_cl_leanmodel_side_highpass; -float autocvar_cl_leanmodel_side_highpass1; -float autocvar_cl_leanmodel_side_lowpass; -float autocvar_cl_leanmodel_side_limit; -float autocvar_cl_leanmodel_up_speed; -float autocvar_cl_leanmodel_up_highpass; -float autocvar_cl_leanmodel_up_highpass1; -float autocvar_cl_leanmodel_up_lowpass; -float autocvar_cl_leanmodel_up_limit; +float autocvar_cl_leanmodel_speed = 0.3; +float autocvar_cl_leanmodel_limit = 1000; +float autocvar_cl_leanmodel_highpass1 = 0.2; +float autocvar_cl_leanmodel_highpass = 0.2; +float autocvar_cl_leanmodel_lowpass = 0.05; +#define avg_factor(avg_time) (1 - exp(-frametime / max(0.001, avg_time))) #define lowpass(value, frac, ref_store, ret) MACRO_BEGIN \ { \ - float __frac = bound(0, frac, 1); \ - ret = ref_store = ref_store * (1 - __frac) + (value) * __frac; \ + ret = ref_store = ref_store * (1 - frac) + (value) * frac; \ } MACRO_END #define lowpass_limited(value, frac, limit, ref_store, ret) MACRO_BEGIN \ @@ -86,31 +76,63 @@ float autocvar_cl_leanmodel_up_limit; ret = (value) - __f; \ } MACRO_END -#define lowpass3(value, fracx, fracy, fracz, ref_store, ref_out) MACRO_BEGIN \ +#define lowpass2(value, frac, ref_store, ref_out) MACRO_BEGIN \ { \ - lowpass(value.x, fracx, ref_store.x, ref_out.x); \ - lowpass(value.y, fracy, ref_store.y, ref_out.y); \ - lowpass(value.z, fracz, ref_store.z, ref_out.z); \ + lowpass(value.x, frac, ref_store.x, ref_out.x); \ + lowpass(value.y, frac, ref_store.y, ref_out.y); \ } MACRO_END -#define highpass3(value, fracx, fracy, fracz, ref_store, ref_out) MACRO_BEGIN \ +#define lowpass2_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \ { \ - highpass(value.x, fracx, ref_store.x, ref_out.x); \ - highpass(value.y, fracy, ref_store.y, ref_out.y); \ - highpass(value.z, fracz, ref_store.z, ref_out.z); \ + lowpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \ + lowpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \ } MACRO_END -#define highpass3_limited(value, fracx, limitx, fracy, limity, fracz, limitz, ref_store, ref_out) MACRO_BEGIN \ +#define highpass2(value, frac, ref_store, ref_out) MACRO_BEGIN \ { \ - highpass_limited(value.x, fracx, limitx, ref_store.x, ref_out.x); \ - highpass_limited(value.y, fracy, limity, ref_store.y, ref_out.y); \ - highpass_limited(value.z, fracz, limitz, ref_store.z, ref_out.z); \ + highpass(value.x, frac, ref_store.x, ref_out.x); \ + highpass(value.y, frac, ref_store.y, ref_out.y); \ } MACRO_END +#define highpass2_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \ +{ \ + highpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \ + highpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \ +} MACRO_END + +#define lowpass3(value, frac, ref_store, ref_out) MACRO_BEGIN \ +{ \ + lowpass(value.x, frac, ref_store.x, ref_out.x); \ + lowpass(value.y, frac, ref_store.y, ref_out.y); \ + lowpass(value.z, frac, ref_store.z, ref_out.z); \ +} MACRO_END + +#define highpass3(value, frac, ref_store, ref_out) MACRO_BEGIN \ +{ \ + highpass(value.x, frac, ref_store.x, ref_out.x); \ + highpass(value.y, frac, ref_store.y, ref_out.y); \ + highpass(value.z, frac, ref_store.z, ref_out.z); \ +} MACRO_END + +#define highpass3_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \ +{ \ + highpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \ + highpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \ + highpass_limited(value.z, frac, limit, ref_store.z, ref_out.z); \ +} MACRO_END + +#define lowpass3_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \ +{ \ + lowpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \ + lowpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \ + lowpass_limited(value.z, frac, limit, ref_store.z, ref_out.z); \ +} MACRO_END + +bool autocvar_cl_followmodel_velocity_absolute; void viewmodel_animate(entity this) { static float prevtime; - float frametime = (time - prevtime) * STAT(MOVEVARS_TIMESCALE); + float frametime = (time - prevtime); prevtime = time; if (autocvar_chase_active) return; @@ -131,84 +153,90 @@ void viewmodel_animate(entity this) } oldonground = clonground; - vector gunorg = '0 0 0', gunangles = '0 0 0'; - static vector gunorg_prev = '0 0 0', gunangles_prev = '0 0 0'; bool teleported = view.csqcmodel_teleported; - // 1. if we teleported, clear the frametime... the lowpass will recover the previous value then - if (teleported) + float frac; + if(autocvar_cl_followmodel) { - // try to fix the first highpass; result is NOT - // perfect! TODO find a better fix + vector gunorg = '0 0 0'; + static vector vel_average; + static vector gunorg_prev = '0 0 0'; + static vector gunorg_adjustment_highpass; + static vector gunorg_adjustment_lowpass; + + vector vel; + if(autocvar_cl_followmodel_velocity_absolute) + vel = view.velocity; + else + { + vector forward, right = '0 0 0', up = '0 0 0'; + MAKEVECTORS(makevectors, view_angles, forward, right, up); + vel.x = view.velocity * forward; + vel.y = view.velocity * right * -1; + vel.z = view.velocity * up; + } + + frac = avg_factor(autocvar_cl_followmodel_velocity_lowpass); + lowpass3_limited(vel, frac, autocvar_cl_followmodel_limit, vel_average, gunorg); + + gunorg *= -autocvar_cl_followmodel_speed * 0.042; + + // perform highpass/lowpass on the adjustment vectors (turning velocity into acceleration!) + // trick: we must do the lowpass LAST, so the lowpass vector IS the final vector! + frac = avg_factor(autocvar_cl_followmodel_highpass); + highpass3(gunorg, frac, gunorg_adjustment_highpass, gunorg); + frac = avg_factor(autocvar_cl_followmodel_lowpass); + lowpass3(gunorg, frac, gunorg_adjustment_lowpass, gunorg); + + if(autocvar_cl_followmodel_velocity_absolute) + { + vector fixed_gunorg; + vector forward, right = '0 0 0', up = '0 0 0'; + MAKEVECTORS(makevectors, view_angles, forward, right, up); + fixed_gunorg.x = gunorg * forward; + fixed_gunorg.y = gunorg * right * -1; + fixed_gunorg.z = gunorg * up; + gunorg = fixed_gunorg; + } + + this.origin += gunorg; + } + + if(autocvar_cl_leanmodel) + { + vector gunangles = '0 0 0'; + static vector gunangles_prev = '0 0 0'; + static vector gunangles_highpass = '0 0 0'; + static vector gunangles_adjustment_highpass; + static vector gunangles_adjustment_lowpass; + + if (teleported) + gunangles_prev = view_angles; + + // in the highpass, we _store_ the DIFFERENCE to the actual view angles... + gunangles_highpass += gunangles_prev; + PITCH(gunangles_highpass) += 360 * floor((PITCH(view_angles) - PITCH(gunangles_highpass)) / 360 + 0.5); + YAW(gunangles_highpass) += 360 * floor((YAW(view_angles) - YAW(gunangles_highpass)) / 360 + 0.5); + ROLL(gunangles_highpass) += 360 * floor((ROLL(view_angles) - ROLL(gunangles_highpass)) / 360 + 0.5); + frac = avg_factor(autocvar_cl_leanmodel_highpass1); + highpass2_limited(view_angles, frac, autocvar_cl_leanmodel_limit, gunangles_highpass, gunangles); gunangles_prev = view_angles; - gunorg_prev = view_origin; - } - - static vector gunorg_highpass = '0 0 0'; - - // 2. for the gun origin, only keep the high frequency (non-DC) parts, which is "somewhat like velocity" - gunorg_highpass += gunorg_prev; - highpass3_limited(view_origin, - frametime * autocvar_cl_followmodel_side_highpass1, autocvar_cl_followmodel_side_limit, - frametime * autocvar_cl_followmodel_side_highpass1, autocvar_cl_followmodel_side_limit, - frametime * autocvar_cl_followmodel_up_highpass1, autocvar_cl_followmodel_up_limit, - gunorg_highpass, gunorg); - gunorg_prev = view_origin; - gunorg_highpass -= gunorg_prev; - - static vector gunangles_highpass = '0 0 0'; - - // in the highpass, we _store_ the DIFFERENCE to the actual view angles... - gunangles_highpass += gunangles_prev; - PITCH(gunangles_highpass) += 360 * floor((PITCH(view_angles) - PITCH(gunangles_highpass)) / 360 + 0.5); - YAW(gunangles_highpass) += 360 * floor((YAW(view_angles) - YAW(gunangles_highpass)) / 360 + 0.5); - ROLL(gunangles_highpass) += 360 * floor((ROLL(view_angles) - ROLL(gunangles_highpass)) / 360 + 0.5); - highpass3_limited(view_angles, - frametime * autocvar_cl_leanmodel_up_highpass1, autocvar_cl_leanmodel_up_limit, - frametime * autocvar_cl_leanmodel_side_highpass1, autocvar_cl_leanmodel_side_limit, - 0, 0, - gunangles_highpass, gunangles); - gunangles_prev = view_angles; - gunangles_highpass -= gunangles_prev; - - // 3. calculate the RAW adjustment vectors - gunorg.x *= (autocvar_cl_followmodel ? -autocvar_cl_followmodel_side_speed : 0); - gunorg.y *= (autocvar_cl_followmodel ? -autocvar_cl_followmodel_side_speed : 0); - gunorg.z *= (autocvar_cl_followmodel ? -autocvar_cl_followmodel_up_speed : 0); - - PITCH(gunangles) *= (autocvar_cl_leanmodel ? -autocvar_cl_leanmodel_up_speed : 0); - YAW(gunangles) *= (autocvar_cl_leanmodel ? -autocvar_cl_leanmodel_side_speed : 0); - ROLL(gunangles) = 0; - - static vector gunorg_adjustment_highpass; - static vector gunorg_adjustment_lowpass; - static vector gunangles_adjustment_highpass; - static vector gunangles_adjustment_lowpass; - - // 4. perform highpass/lowpass on the adjustment vectors (turning velocity into acceleration!) - // trick: we must do the lowpass LAST, so the lowpass vector IS the final vector! - highpass3(gunorg, - frametime * autocvar_cl_followmodel_side_highpass, - frametime * autocvar_cl_followmodel_side_highpass, - frametime * autocvar_cl_followmodel_up_highpass, - gunorg_adjustment_highpass, gunorg); - lowpass3(gunorg, - frametime * autocvar_cl_followmodel_side_lowpass, - frametime * autocvar_cl_followmodel_side_lowpass, - frametime * autocvar_cl_followmodel_up_lowpass, - gunorg_adjustment_lowpass, gunorg); - // we assume here: PITCH = 0, YAW = 1, ROLL = 2 - highpass3(gunangles, - frametime * autocvar_cl_leanmodel_up_highpass, - frametime * autocvar_cl_leanmodel_side_highpass, - 0, - gunangles_adjustment_highpass, gunangles); - lowpass3(gunangles, - frametime * autocvar_cl_leanmodel_up_lowpass, - frametime * autocvar_cl_leanmodel_side_lowpass, - 0, - gunangles_adjustment_lowpass, gunangles); + gunangles_highpass -= gunangles_prev; + + PITCH(gunangles) *= -autocvar_cl_leanmodel_speed; + YAW(gunangles) *= -autocvar_cl_leanmodel_speed; + + // we assume here: PITCH = 0, YAW = 1, ROLL = 2 + frac = avg_factor(autocvar_cl_leanmodel_highpass); + highpass2(gunangles, frac, gunangles_adjustment_highpass, gunangles); + frac = avg_factor(autocvar_cl_leanmodel_lowpass); + lowpass2(gunangles, frac, gunangles_adjustment_lowpass, gunangles); + + gunangles.x = -gunangles.x; // pitch was inverted, now that actually matters + this.angles += gunangles; + } + float xyspeed = bound(0, vlen(vec2(view.velocity)), 400); // vertical view bobbing code @@ -229,7 +257,6 @@ void viewmodel_animate(entity this) // Sajt: I tried to smooth out the transitions between bob and no bob, which works // for the most part, but for some reason when you go through a message trigger or // pick up an item or anything like that it will momentarily jolt the gun. - vector forward, right = '0 0 0', up = '0 0 0'; float bspeed; float t = 1; float s = time * autocvar_cl_bobmodel_speed; @@ -251,17 +278,12 @@ void viewmodel_animate(entity this) t *= 5; } bspeed = xyspeed * 0.01; - MAKEVECTORS(makevectors, view_angles, forward, right, up); - float bobr = bspeed * autocvar_cl_bobmodel_side * autocvar_cl_viewmodel_scale * sin(s) * t; - gunorg += bobr * right; - float bobu = bspeed * autocvar_cl_bobmodel_up * autocvar_cl_viewmodel_scale * cos(s * 2) * t; - gunorg += bobu * up; - } - vector v = rotate(gunorg, YAW(view_angles) * DEG2RAD); // rotate world coordinates to relative ones - v.z = gunorg.z; - this.origin += v; - gunangles.x = -gunangles.x; // pitch was inverted, now that actually matters - this.angles += gunangles; + vector gunorg = '0 0 0'; + gunorg.y += bspeed * autocvar_cl_bobmodel_side * autocvar_cl_viewmodel_scale * sin(s) * t; + gunorg.z += bspeed * autocvar_cl_bobmodel_up * autocvar_cl_viewmodel_scale * cos(s * 2) * t; + + this.origin += gunorg; + } } .vector viewmodel_origin, viewmodel_angles; @@ -271,6 +293,8 @@ void viewmodel_animate(entity this) void viewmodel_draw(entity this) { + if(!activeweapon) + return; int mask = (intermission || (STAT(HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL; float a = this.alpha; static bool wasinvehicle; @@ -341,7 +365,6 @@ entity viewmodel; STATIC_INIT(viewmodel) { viewmodel = new(viewmodel); make_pure(viewmodel); - viewmodel.draw = viewmodel_draw; } entity porto; @@ -1654,6 +1677,10 @@ void CSQC_UpdateView(float w, float h) ov_enabled = false; } + // run viewmodel_draw before updating view_angles to the angles calculated by WarpZone_FixView + // viewmodel_draw needs to use the view_angles set by the engine on every CSQC_UpdateView call + viewmodel_draw(viewmodel); + // Render the Scene view_origin = getpropertyvec(VF_ORIGIN); view_angles = getpropertyvec(VF_ANGLES); diff --git a/qcsrc/common/effects/qc/globalsound.qc b/qcsrc/common/effects/qc/globalsound.qc index 061ec2c74..f13b23104 100644 --- a/qcsrc/common/effects/qc/globalsound.qc +++ b/qcsrc/common/effects/qc/globalsound.qc @@ -12,7 +12,11 @@ REGISTER_NET_TEMP(globalsound) REGISTER_NET_TEMP(playersound) + string GlobalSound_sample(string pair, float r); + #ifdef SVQC + /** Use new sound handling. TODO: use when sounds play correctly on clients */ + bool autocvar_g_debug_globalsounds = false; /** * @param from the source entity, its position is sent * @param gs the global sound def @@ -22,6 +26,18 @@ { assert(IS_PLAYER(from), eprint(from)); if (channel == MSG_ONE && !IS_REAL_CLIENT(msg_entity)) return; + if (!autocvar_g_debug_globalsounds) { + string sample = GlobalSound_sample(gs.m_globalsoundstr, r); + switch (channel) { + case MSG_ONE: + soundto(channel, from, chan, sample, vol, atten); + break; + case MSG_ALL: + _sound(from, chan, sample, vol, atten); + break; + } + return; + } WriteHeader(channel, globalsound); WriteByte(channel, gs.m_id); WriteByte(channel, r * 255); @@ -45,6 +61,20 @@ { assert(IS_PLAYER(from), eprint(from)); if (channel == MSG_ONE && !IS_REAL_CLIENT(msg_entity)) return; + if (!autocvar_g_debug_globalsounds) { + UpdatePlayerSounds(from); + string s = from.(ps.m_playersoundfld); + string sample = GlobalSound_sample(s, r); + switch (channel) { + case MSG_ONE: + soundto(channel, from, chan, sample, vol, atten); + break; + case MSG_ALL: + _sound(from, chan, sample, vol, atten); + break; + } + return; + } WriteHeader(channel, playersound); WriteByte(channel, ps.m_id); WriteByte(channel, r * 255); @@ -60,8 +90,6 @@ } #endif - string GlobalSound_sample(string pair, float r); - #ifdef CSQC NET_HANDLE(globalsound, bool isnew) @@ -220,7 +248,7 @@ fclose(fh); } - #ifdef CSQC + //#ifdef CSQC .string GetPlayerSoundSampleField(string type) { @@ -229,14 +257,14 @@ void ClearPlayerSounds(entity this) { - FOREACH(PlayerSounds, true, LAMBDA( + FOREACH(PlayerSounds, true, { .string fld = it.m_playersoundfld; if (this.(fld)) - { - strunzone(this.(fld)); - this.(fld) = string_null; - } - )); + { + strunzone(this.(fld)); + this.(fld) = string_null; + } + }); } bool LoadPlayerSounds(entity this, string f, bool strict) @@ -290,12 +318,10 @@ LoadPlayerSounds(this, get_model_datafilename(this.model, 0, "sounds"), true); } - #endif + //#endif #ifdef SVQC - bool autocvar_g_debug_globalsounds; - void _GlobalSound(entity this, entity gs, entity ps, string sample, int chan, int voicetype, bool fake) { if (gs == NULL && ps == NULL && sample == "") return; @@ -370,13 +396,7 @@ ? bound(ATTEN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, \ ATTEN_MAX) \ : ATTEN_NONE; \ - if (gs) \ - { \ - if(autocvar_g_debug_globalsounds) \ - globalsound(MSG_ONE, this, gs, r, chan, VOL_BASEVOICE, atten); \ - else \ - soundto(MSG_ONE, this, chan, GlobalSound_sample(gs.m_globalsoundstr, r), VOL_BASE, ATTEN_NORM); \ - } \ + if (gs) globalsound(MSG_ONE, this, gs, r, chan, VOL_BASEVOICE, atten); \ else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASEVOICE, atten); \ else soundto(MSG_ONE, this, chan, sample, VOL_BASEVOICE, atten); \ } \ @@ -407,13 +427,7 @@ } else { - if (gs) - { - if(autocvar_g_debug_globalsounds) - globalsound(MSG_ALL, this, gs, r, chan, VOL_BASE, ATTEN_NORM); - else - _sound(this, chan, GlobalSound_sample(gs.m_globalsoundstr, r), VOL_BASE, ATTEN_NORM); - } + if (gs) globalsound(MSG_ALL, this, gs, r, chan, VOL_BASE, ATTEN_NORM); else if (ps) playersound(MSG_ALL, this, ps, r, chan, VOL_BASE, ATTEN_NORM); else _sound(this, chan, sample, VOL_BASE, ATTEN_NORM); } diff --git a/qcsrc/common/effects/qc/globalsound.qh b/qcsrc/common/effects/qc/globalsound.qh index 1c2aa6461..22e04e94a 100644 --- a/qcsrc/common/effects/qc/globalsound.qh +++ b/qcsrc/common/effects/qc/globalsound.qh @@ -108,13 +108,13 @@ REGISTER_GLOBALSOUND(FALL_METAL, "misc/metalhitground 4") bool GetPlayerSoundSampleField_notFound; void PrecachePlayerSounds(string f); -#ifdef CSQC +//#ifdef CSQC .string GetVoiceMessageSampleField(string type); .string GetPlayerSoundSampleField(string type); void ClearPlayerSounds(entity this); float LoadPlayerSounds(entity this, string f, bool strict); void UpdatePlayerSounds(entity this); -#endif +//#endif #ifdef SVQC diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index 6a585e68e..8b4f9234d 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -685,7 +685,7 @@ void HUD_Minigame_Mouse() if ( HUD_MinigameMenu_IsOpened() && HUD_mouse_over(HUD_PANEL(MINIGAME_MENU)) ) HUD_MinigameMenu_MouseInput(); - draw_cursor_normal(mousepos-'8 4 0', '1 1 1', panel_fg_alpha); + draw_cursor_normal(mousepos, '1 1 1', panel_fg_alpha); } bool HUD_Minigame_Showpanels() diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index ccc3b83aa..346062d64 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -1361,6 +1361,9 @@ bool Monster_Spawn(entity this, int mon_id) if(autocvar_g_nodepthtestplayers) { this.effects |= EF_NODEPTHTEST; } if(mon.spawnflags & MONSTER_TYPE_SWIM) { this.flags |= FL_SWIM; } + if(autocvar_g_playerclip_collisions) + this.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP; + if(mon.spawnflags & MONSTER_TYPE_FLY) { this.flags |= FL_FLY; diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index fcfce9ab7..b54ee9176 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -2,6 +2,12 @@ #ifdef IMPLEMENTATION +#ifdef SVQC +bool autocvar_g_nades_nade_small; +#endif + +REGISTER_STAT(NADES_SMALL, int, autocvar_g_nades_nade_small) + #ifndef MENUQC entity Nade_TrailEffect(int proj, int nade_team) { @@ -63,8 +69,16 @@ MUTATOR_HOOKFUNCTION(cl_nades, EditProjectile) entity nade_type = Nade_FromProjectile(self.cnt); if (nade_type == NADE_TYPE_Null) return; - self.mins = '-16 -16 -16'; - self.maxs = '16 16 16'; + if(STAT(NADES_SMALL, NULL)) + { + self.mins = '-8 -8 -8'; + self.maxs = '8 8 8'; + } + else + { + self.mins = '-16 -16 -16'; + self.maxs = '16 16 16'; + } self.colormod = nade_type.m_color; self.move_movetype = MOVETYPE_BOUNCE; self.move_touch = func_null; @@ -657,6 +671,20 @@ void nade_boom() remove(self); } +void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, string pntype); +void nade_pickup(entity this, entity thenade) +{ + spawn_held_nade(this, thenade.realowner, autocvar_g_nades_pickup_time, thenade.nade_type, thenade.pokenade_type); + + // set refire so player can't even + this.nade_refire = time + autocvar_g_nades_nade_refire; + this.nade_timer = 0; + + if(this.nade) + this.nade.nade_time_primed = thenade.nade_time_primed; +} + +bool CanThrowNade(entity this); void nade_touch() {SELFPARAM(); if(other) @@ -664,6 +692,19 @@ void nade_touch() if(other == self.realowner) return; // no self impacts + + if(autocvar_g_nades_pickup) + if(time >= self.spawnshieldtime) + if(!other.nade && self.health == self.max_health) // no boosted shot pickups, thank you very much + if(!other.frozen) + if(CanThrowNade(other)) // prevent some obvious things, like dead players + if(IS_REAL_CLIENT(other)) // above checks for IS_PLAYER, don't need to do it here + { + nade_pickup(other, self); + sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX)); + remove(self); + return; + } /*float is_weapclip = 0; if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW) if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID)) @@ -766,7 +807,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i nade_burn_spawn(this); } -void toss_nade(entity e, vector _velocity, float _time) +void toss_nade(entity e, bool set_owner, vector _velocity, float _time) {SELFPARAM(); if(e.nade == world) return; @@ -793,7 +834,10 @@ void toss_nade(entity e, vector _velocity, float _time) //setmodel(_nade, MDL_PROJECTILE_NADE); //setattachment(_nade, world, ""); PROJECTILE_MAKETRIGGER(_nade); - setsize(_nade, '-16 -16 -16', '16 16 16'); + if(STAT(NADES_SMALL, e)) + setsize(_nade, '-8 -8 -8', '8 8 8'); + else + setsize(_nade, '-16 -16 -16', '16 16 16'); _nade.movetype = MOVETYPE_BOUNCE; tracebox(_nade.origin, _nade.mins, _nade.maxs, _nade.origin, false, _nade); @@ -809,7 +853,11 @@ void toss_nade(entity e, vector _velocity, float _time) else _nade.velocity = W_CalculateProjectileVelocity(e.velocity, _velocity, true); + if(set_owner) + _nade.realowner = e; + _nade.touch = nade_touch; + _nade.spawnshieldtime = time + 0.1; // prevent instantly picking up again _nade.health = autocvar_g_nades_nade_health; _nade.max_health = _nade.health; _nade.takedamage = DAMAGE_AIM; @@ -881,7 +929,7 @@ MUTATOR_HOOKFUNCTION(nades, PutClientInServer) float nade_customize() {SELFPARAM(); //if(IS_SPEC(other)) { return false; } - if(other == self.realowner || (IS_SPEC(other) && other.enemy == self.realowner)) + if(other == self.exteriormodeltoclient || (IS_SPEC(other) && other.enemy == self.exteriormodeltoclient)) { // somewhat hide the model, but keep the glow //self.effects = 0; @@ -900,6 +948,42 @@ float nade_customize() return true; } +void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, string pntype) +{ + entity n = new(nade), fn = new(fake_nade); + + n.nade_type = bound(1, ntype, Nades_COUNT); + n.pokenade_type = pntype; + + setmodel(n, MDL_PROJECTILE_NADE); + //setattachment(n, player, "bip01 l hand"); + n.exteriormodeltoclient = player; + n.customizeentityforclient = nade_customize; + n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], player.team).eent_eff_name); + n.colormod = Nades_from(n.nade_type).m_color; + n.realowner = nowner; + n.colormap = player.colormap; + n.glowmod = player.glowmod; + n.wait = time + max(0, ntime); + n.nade_time_primed = time; + n.think = nade_beep; + n.nextthink = max(n.wait - 3, time); + n.projectiledeathtype = DEATH_NADE.m_id; + + setmodel(fn, MDL_NADE_VIEW); + .entity weaponentity = weaponentities[0]; // TODO: unhardcode + setattachment(fn, player.(weaponentity), ""); + fn.realowner = fn.owner = player; + fn.colormod = Nades_from(n.nade_type).m_color; + fn.colormap = player.colormap; + fn.glowmod = player.glowmod; + fn.think = SUB_Remove_self; + fn.nextthink = n.wait; + + player.nade = n; + player.fake_nade = fn; +} + void nade_prime() {SELFPARAM(); if(autocvar_g_nades_bonus_only) @@ -912,71 +996,44 @@ void nade_prime() if(self.fake_nade) remove(self.fake_nade); - entity n = new(nade), fn = new(fake_nade); + int ntype; + string pntype = self.pokenade_type; if(self.items & ITEM_Strength.m_itemid && autocvar_g_nades_bonus_onstrength) - n.nade_type = self.nade_type; + ntype = self.nade_type; else if (self.bonus_nades >= 1) { - n.nade_type = self.nade_type; - n.pokenade_type = self.pokenade_type; + ntype = self.nade_type; + pntype = self.pokenade_type; self.bonus_nades -= 1; } else { - n.nade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_nade_type : autocvar_g_nades_nade_type); - n.pokenade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type); + ntype = ((autocvar_g_nades_client_select) ? self.cvar_cl_nade_type : autocvar_g_nades_nade_type); + pntype = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type); } - n.nade_type = bound(1, n.nade_type, Nades_COUNT); - - setmodel(n, MDL_PROJECTILE_NADE); - //setattachment(n, self, "bip01 l hand"); - n.exteriormodeltoclient = self; - n.customizeentityforclient = nade_customize; - n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], self.team).eent_eff_name); - n.colormod = Nades_from(n.nade_type).m_color; - n.realowner = self; - n.colormap = self.colormap; - n.glowmod = self.glowmod; - n.wait = time + autocvar_g_nades_nade_lifetime; - n.nade_time_primed = time; - n.think = nade_beep; - n.nextthink = max(n.wait - 3, time); - n.projectiledeathtype = DEATH_NADE.m_id; - - setmodel(fn, MDL_NADE_VIEW); - .entity weaponentity = weaponentities[0]; // TODO: unhardcode - setattachment(fn, self.(weaponentity), ""); - fn.realowner = fn.owner = self; - fn.colormod = Nades_from(n.nade_type).m_color; - fn.colormap = self.colormap; - fn.glowmod = self.glowmod; - fn.think = SUB_Remove_self; - fn.nextthink = n.wait; - - self.nade = n; - self.fake_nade = fn; + spawn_held_nade(self, self, autocvar_g_nades_nade_lifetime, ntype, pntype); } -float CanThrowNade() -{SELFPARAM(); - if(self.vehicle) +bool CanThrowNade(entity this) +{ + if(this.vehicle) return false; if(gameover) return false; - if(IS_DEAD(self)) + if(IS_DEAD(this)) return false; if (!autocvar_g_nades) return false; // allow turning them off mid match - if(forbidWeaponUse(self)) + if(forbidWeaponUse(this)) return false; - if (!IS_PLAYER(self)) + if (!IS_PLAYER(this)) return false; return true; @@ -986,7 +1043,7 @@ float CanThrowNade() void nades_CheckThrow() {SELFPARAM(); - if(!CanThrowNade()) + if(!CanThrowNade(self)) return; entity held_nade = self.nade; @@ -1008,7 +1065,7 @@ void nades_CheckThrow() float _force = time - held_nade.nade_time_primed; _force /= autocvar_g_nades_nade_lifetime; _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce)); - toss_nade(self, (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05) * _force, 0); + toss_nade(self, true, (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05) * _force, 0); } } } @@ -1027,7 +1084,7 @@ void nades_Clear(entity player) MUTATOR_HOOKFUNCTION(nades, VehicleEnter) { if(vh_player.nade) - toss_nade(vh_player, '0 0 100', max(vh_player.nade.wait, time + 0.05)); + toss_nade(vh_player, true, '0 0 100', max(vh_player.nade.wait, time + 0.05)); return false; } @@ -1046,10 +1103,10 @@ CLASS(NadeOffhand, OffhandWeapon) held_nade.angles_y = player.angles.y; if (time + 0.1 >= held_nade.wait) - toss_nade(player, '0 0 0', time + 0.05); + toss_nade(player, false, '0 0 0', time + 0.05); } - if (!CanThrowNade()) return; + if (!CanThrowNade(player)) return; if (!(time > player.nade_refire)) return; if (key_pressed) { if (!held_nade) { @@ -1062,7 +1119,7 @@ CLASS(NadeOffhand, OffhandWeapon) float _force = time - held_nade.nade_time_primed; _force /= autocvar_g_nades_nade_lifetime; _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce)); - toss_nade(player, (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1) * _force, 0); + toss_nade(player, false, (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1) * _force, 0); } } } @@ -1201,7 +1258,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerDies, CBC_ORDER_LAST) { if(frag_target.nade) if(!STAT(FROZEN, frag_target) || !autocvar_g_freezetag_revive_nade) - toss_nade(frag_target, '0 0 100', max(frag_target.nade.wait, time + 0.05)); + toss_nade(frag_target, true, '0 0 100', max(frag_target.nade.wait, time + 0.05)); float killcount_bonus = ((frag_attacker.killcount >= 1) ? bound(0, autocvar_g_nades_bonus_score_minor * frag_attacker.killcount, autocvar_g_nades_bonus_score_medium) : autocvar_g_nades_bonus_score_minor); @@ -1264,7 +1321,7 @@ MUTATOR_HOOKFUNCTION(nades, MonsterDies) MUTATOR_HOOKFUNCTION(nades, DropSpecialItems) { if(frag_target.nade) - toss_nade(frag_target, '0 0 0', time + 0.05); + toss_nade(frag_target, true, '0 0 0', time + 0.05); return false; } diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 0da3c1df3..208b16c3b 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -1283,6 +1283,10 @@ bool IsFlying(entity this) return true; } +#ifdef CSQC +float autocvar_slowmo; +#endif + void PM_Main(entity this) { int buttons = PHYS_INPUT_BUTTON_MASK(this); @@ -1321,6 +1325,9 @@ void PM_Main(entity this) if (this.PlayerPhysplug) if (this.PlayerPhysplug()) return; +#elif defined(CSQC) + if(autocvar_slowmo != STAT(MOVEVARS_TIMESCALE)) + cvar_set("slowmo", ftos(STAT(MOVEVARS_TIMESCALE))); #endif #ifdef SVQC diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 0bb3ac174..7003dfd7f 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -1529,7 +1529,7 @@ spawnfunc(target_items) if(self.ammo_plasma != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_plasma), "plasma"); if(self.ammo_fuel != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_fuel), "fuel"); if(self.health != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.health), "health"); - if(self.armorvalue != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.health), "armor"); + if(self.armorvalue != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.armorvalue), "armor"); FOREACH(Weapons, it != WEP_Null, LAMBDA(self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.weapons & (it.m_wepset)), it.netname))); } self.netname = strzone(self.netname); diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index d531b8c3f..6232db886 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -432,6 +432,7 @@ void CL_WeaponEntity_SetModel(entity this, string name) #endif } _setmodel(this.weaponchild, W_Model(strcat("v_", name, ".md3"))); + setsize(this.weaponchild, '0 0 0', '0 0 0'); setattachment(this.weaponchild, this, t); } else @@ -440,6 +441,7 @@ void CL_WeaponEntity_SetModel(entity this, string name) this.weaponchild = NULL; } + setsize(this, '0 0 0', '0 0 0'); setorigin(this, '0 0 0'); this.angles = '0 0 0'; this.frame = 0; diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 3c4e4c43f..654bd2bc9 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -465,6 +465,8 @@ vector autocvar_g_nades_throw_offset; bool autocvar_g_nades_spawn; int autocvar_g_nades_spawn_count; bool autocvar_g_nades_client_select; +bool autocvar_g_nades_pickup = true; +float autocvar_g_nades_pickup_time = 2; float autocvar_g_nades_nade_lifetime; float autocvar_g_nades_nade_minforce; float autocvar_g_nades_nade_maxforce; diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 4972d818f..1637d8676 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -126,7 +126,11 @@ void CL_ExteriorWeaponentity_Think() this.weaponname = this.owner.weaponname; this.dmg = this.owner.modelindex; this.deadflag = this.owner.deadflag; - if (this.owner.weaponname != "") _setmodel(this, W_Model(strcat("v_", this.owner.weaponname, ".md3"))); + if (this.owner.weaponname != "") + { + _setmodel(this, W_Model(strcat("v_", this.owner.weaponname, ".md3"))); + setsize(this, '0 0 0', '0 0 0'); + } else this.model = ""; int tag_found; diff --git a/scripts/weapons.shader b/scripts/weapons.shader index c5c673fbf..bef318392 100644 --- a/scripts/weapons.shader +++ b/scripts/weapons.shader @@ -31,11 +31,11 @@ glauncher rgbgen lightingDiffuse } } -hagar2 +hagar { dpreflectcube cubemaps/default/sky { - map textures/hagar2.tga + map textures/hagar.tga rgbgen lightingDiffuse } } @@ -111,3 +111,11 @@ shotgun rgbgen lightingDiffuse } } +SniperRifle +{ + dpreflectcube cubemaps/default/sky + { + map textures/sniperrifle.tga + rgbgen lightingDiffuse + } +} diff --git a/textures/campingrifle.tga b/textures/campingrifle.tga deleted file mode 100644 index 6189b51e9..000000000 Binary files a/textures/campingrifle.tga and /dev/null differ diff --git a/textures/campingrifle_bump.tga b/textures/campingrifle_bump.tga deleted file mode 100644 index 28bd453d6..000000000 Binary files a/textures/campingrifle_bump.tga and /dev/null differ diff --git a/textures/campingrifle_gloss.tga b/textures/campingrifle_gloss.tga deleted file mode 100644 index 7f4b0326d..000000000 Binary files a/textures/campingrifle_gloss.tga and /dev/null differ diff --git a/textures/campingrifle_glow.tga b/textures/campingrifle_glow.tga deleted file mode 100644 index f42532995..000000000 Binary files a/textures/campingrifle_glow.tga and /dev/null differ diff --git a/textures/campingrifle_screen.tga b/textures/campingrifle_screen.tga deleted file mode 100644 index 5ffda6faf..000000000 Binary files a/textures/campingrifle_screen.tga and /dev/null differ diff --git a/textures/hagar.tga b/textures/hagar.tga new file mode 100644 index 000000000..1e2d5cfdd Binary files /dev/null and b/textures/hagar.tga differ diff --git a/textures/hagar2.tga b/textures/hagar2.tga deleted file mode 100644 index f05fef985..000000000 Binary files a/textures/hagar2.tga and /dev/null differ diff --git a/textures/hagar2_gloss.tga b/textures/hagar2_gloss.tga deleted file mode 100644 index f4f597a4a..000000000 Binary files a/textures/hagar2_gloss.tga and /dev/null differ diff --git a/textures/hagar2_glow.tga b/textures/hagar2_glow.tga deleted file mode 100644 index cd4b35312..000000000 Binary files a/textures/hagar2_glow.tga and /dev/null differ diff --git a/textures/hagar2_norm.tga b/textures/hagar2_norm.tga deleted file mode 100644 index 145509deb..000000000 Binary files a/textures/hagar2_norm.tga and /dev/null differ diff --git a/textures/hagar2_reflect.tga b/textures/hagar2_reflect.tga deleted file mode 100644 index 1381edcd6..000000000 Binary files a/textures/hagar2_reflect.tga and /dev/null differ diff --git a/textures/hagar2_shirt.tga b/textures/hagar2_shirt.tga deleted file mode 100644 index 4527f7e31..000000000 Binary files a/textures/hagar2_shirt.tga and /dev/null differ diff --git a/textures/hagar_glow.tga b/textures/hagar_glow.tga new file mode 100644 index 000000000..e1d9548f7 Binary files /dev/null and b/textures/hagar_glow.tga differ diff --git a/textures/hagar_norm.tga b/textures/hagar_norm.tga new file mode 100644 index 000000000..b758791e3 Binary files /dev/null and b/textures/hagar_norm.tga differ diff --git a/textures/hagar_reflect.tga b/textures/hagar_reflect.tga new file mode 100644 index 000000000..f784c2db5 Binary files /dev/null and b/textures/hagar_reflect.tga differ diff --git a/textures/hagar_shirt.tga b/textures/hagar_shirt.tga new file mode 100644 index 000000000..270d4464a Binary files /dev/null and b/textures/hagar_shirt.tga differ diff --git a/textures/hagar_spec.tga b/textures/hagar_spec.tga new file mode 100644 index 000000000..e44d88ba0 Binary files /dev/null and b/textures/hagar_spec.tga differ diff --git a/textures/sniperrifle.tga b/textures/sniperrifle.tga new file mode 100644 index 000000000..0448be7f6 Binary files /dev/null and b/textures/sniperrifle.tga differ diff --git a/textures/sniperrifle_bump.tga b/textures/sniperrifle_bump.tga new file mode 100644 index 000000000..2496bcbce Binary files /dev/null and b/textures/sniperrifle_bump.tga differ diff --git a/textures/sniperrifle_glow.tga b/textures/sniperrifle_glow.tga new file mode 100644 index 000000000..776771371 Binary files /dev/null and b/textures/sniperrifle_glow.tga differ diff --git a/textures/sniperrifle_reflect.tga b/textures/sniperrifle_reflect.tga new file mode 100644 index 000000000..ecd89a973 Binary files /dev/null and b/textures/sniperrifle_reflect.tga differ