]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
save work to continue another work on another branch
authordrjaska <drjaska83@gmail.com>
Sat, 4 Sep 2021 07:29:22 +0000 (10:29 +0300)
committerdrjaska <drjaska83@gmail.com>
Sat, 4 Sep 2021 07:29:22 +0000 (10:29 +0300)
bal-wep-mario.cfg
bal-wep-nexuiz25.cfg
bal-wep-samual.cfg
bal-wep-xdf.cfg
bal-wep-xonotic.cfg
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/machinegun.qh

index 936c39289b9f3a3a149f9a39b93012a3d1712d8b..099703d449febfe87b7186789ab7a57a38d4eabe 100644 (file)
@@ -86,6 +86,8 @@ set g_balance_machinegun_spread_add 0.012
 set g_balance_machinegun_spread_decay 0.036
 set g_balance_machinegun_spread_max 0.05
 set g_balance_machinegun_spread_min 0.02
+set g_balance_machinegun_spread_cold_damagemultiplier 1
+set g_balance_machinegun_spread_heat_damagemultiplier 1
 set g_balance_machinegun_sustained_ammo 1
 set g_balance_machinegun_sustained_damage 10
 set g_balance_machinegun_sustained_force 3
index 5278815d9f7187beac4d6250d566a187a3edaa49..6206a5ce8c15244baa9be506bf2eebadc7060de8 100644 (file)
@@ -86,6 +86,8 @@ set g_balance_machinegun_spread_add 0.02
 set g_balance_machinegun_spread_decay 0.06
 set g_balance_machinegun_spread_max 0.6
 set g_balance_machinegun_spread_min 0.02
+set g_balance_machinegun_spread_cold_damagemultiplier 1
+set g_balance_machinegun_spread_heat_damagemultiplier 1
 set g_balance_machinegun_sustained_ammo 1
 set g_balance_machinegun_sustained_damage 15
 set g_balance_machinegun_sustained_force 27
index 27856dfe8b999cd047f7b79db146c19a0b6e70f4..b59b48389998771da7dda5500e9ee7e2af7968fb 100644 (file)
@@ -86,6 +86,8 @@ set g_balance_machinegun_spread_add 0.012
 set g_balance_machinegun_spread_decay 0.036
 set g_balance_machinegun_spread_max 0.05
 set g_balance_machinegun_spread_min 0.02
+set g_balance_machinegun_spread_cold_damagemultiplier 1
+set g_balance_machinegun_spread_heat_damagemultiplier 1
 set g_balance_machinegun_sustained_ammo 1
 set g_balance_machinegun_sustained_damage 10
 set g_balance_machinegun_sustained_force 5
index 9e09801aead280607d9e680cd28afeb30fa532f7..ffd06e8c8ac2090c5ff19c84d4f0e54c91db30af 100644 (file)
@@ -86,6 +86,8 @@ set g_balance_machinegun_spread_add 0
 set g_balance_machinegun_spread_decay 0
 set g_balance_machinegun_spread_max 0
 set g_balance_machinegun_spread_min 0
+set g_balance_machinegun_spread_cold_damagemultiplier 1
+set g_balance_machinegun_spread_heat_damagemultiplier 1
 set g_balance_machinegun_sustained_ammo 1
 set g_balance_machinegun_sustained_damage 10
 set g_balance_machinegun_sustained_force 3
index a5423be50076b5de48db57d696a99f9a058ca9c5..541edd93699d27020fd5b7e0318d406668586d26 100644 (file)
@@ -86,6 +86,8 @@ set g_balance_machinegun_spread_add 0.012
 set g_balance_machinegun_spread_decay 0.036
 set g_balance_machinegun_spread_max 0.05
 set g_balance_machinegun_spread_min 0
+set g_balance_machinegun_spread_cold_damagemultiplier 1
+set g_balance_machinegun_spread_heat_damagemultiplier 1
 set g_balance_machinegun_sustained_ammo 1
 set g_balance_machinegun_sustained_damage 10
 set g_balance_machinegun_sustained_force 3
index cc38ad4605b5ffa205564c88ee50cc5c3994dd00..65c7d56f142246986e4bdfee6a0ae30c7abafdb4 100644 (file)
@@ -6,6 +6,15 @@
 
 .float oldTime;
 
+//initiate spread like this so it can be used inversedly, accurate with more firing, like Hyperion weapons from Borderlands
+.float lowerEndOfSpreadSpectrum; .float higherEndOfSpreadSpectrum; .float spreadSpectrumDistance; .bool inversedSpread;
+       if(WEP_CVAR(machinegun, spread_max) > WEP_CVAR(machinegun, spread_min)){
+               lowerEndOfSpreadSpectrum = WEP_CVAR(machinegun, spread_min); higherEndOfSpreadSpectrum = WEP_CVAR(machinegun, spread_max); inversedSpread = false;
+       } else {
+               lowerEndOfSpreadSpectrum = WEP_CVAR(machinegun, spread_max); higherEndOfSpreadSpectrum = WEP_CVAR(machinegun, spread_min); inversedSpread = true;
+       }
+       spreadSpectrumDistance = higherEndOfSpreadSpectrum - lowerEndOfSpreadSpectrum;
+
 void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity weaponentity)
 {
        W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((actor.(weaponentity).misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)), deathtype);
@@ -124,11 +133,43 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
        //print("\n Old time: ");
        //print(sprintf("%f ", actor.(weaponentity).oldTime));
        
-       actor.(weaponentity).machinegun_spread_accumulation = max(actor.(weaponentity).machinegun_spread_accumulation - ((time - actor.(weaponentity).oldTime) * WEP_CVAR(machinegun, spread_decay)), 0);
-       actor.(weaponentity).oldTime = time;
+       if(inversedSpread){
+               // TODO
+       } else {
+               actor.(weaponentity).machinegun_spread_accumulation = max(actor.(weaponentity).machinegun_spread_accumulation - ((time - actor.(weaponentity).oldTime) * WEP_CVAR(machinegun, spread_decay)), 0);
+               actor.(weaponentity).oldTime = time;
+               machinegun_spread = bound(0, WEP_CVAR(machinegun, spread_min) + actor.(weaponentity).machinegun_spread_accumulation, WEP_CVAR(machinegun, spread_max));
+       }
 
-       machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + actor.(weaponentity).machinegun_spread_accumulation, WEP_CVAR(machinegun, spread_max));
-       fireBullet(actor, weaponentity, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), 0, WEP_CVAR(machinegun, sustained_force), thiswep.m_id, EFFECT_BULLET);
+       // function for reducing mg's damage with no spread and adding damage with heated up barrel or vice versa depending on the values of exposed cvars
+       float coldDamageMultiplierApplicationPercent = 1; float heatDamageMultiplierApplicationPercent = 1;
+
+       if(spreadSpectrumDistance > 0){ //avoid division by 0
+               coldDamageMultiplierApplicationPercent = (spreadSpectrumDistance - machinegun_spread)/spreadSpectrumDistance;
+               heatDamageMultiplierApplicationPercent =                                                   machinegun_spread /spreadSpectrumDistance;
+               // these formulas seem to give numbers which are used as the distance from one end to the other
+               // cold = lower end, heat = higher end, spreadSpectrumDistance = higherEndOfSpreadSpectrum - lowerEndOfSpreadSpectrum = 30 for these examples
+               //
+               // examples for cold barrel / coldDamageMultiplierApplicationPercent:
+               // min 5 , spread buildup 100% , max 35
+               // (30 - 30) / 30 = 0   apply none of the multiplier
+               // min 5 , spread buildup  50% , max 35
+               // (30 - 15) / 30 = 0.5 apply half of the multiplier
+               // min 5 , spread buildup   0% , max 35
+               // (30 -  0) / 30 = 1   apply all of the multiplier
+               //
+               // examples for warm barrel / heatDamageMultiplierApplicationPercent:
+               // min 5 , spread buildup   0% , max 35
+               // 30 / 30 = 1   apply all  of the multiplier
+               // min 5 , spread buildup  50% , max 35
+               // 15 / 30 = 0.5 apply half of the multiplier
+               // min 5 , spread buildup 100% , max 35
+               //  0 / 30 = 0   apply none of the multiplier
+       }
+       float heat = (coldDamageMultiplierApplicationPercent*WEP_CVAR(machinegun, spread_cold_damagemultiplier)) * (coldDamageMultiplierApplicationPercent*WEP_CVAR(machinegun, spread_cold_damagemultiplier));
+       
+       fireBullet(actor, weaponentity, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage) * heat, 
+                          0, WEP_CVAR(machinegun, sustained_force), thiswep.m_id, EFFECT_BULLET);
 
        actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
        actor.(weaponentity).machinegun_spread_accumulation = actor.(weaponentity).machinegun_spread_accumulation + WEP_CVAR(machinegun, spread_add);
index e1800fd1b5e5b4b4a60d42f02072bfdb30a5ef80..a138cc10e126db885cd9e1661b705b379b7254e4 100644 (file)
@@ -41,6 +41,8 @@ CLASS(MachineGun, Weapon)
                P(class, prefix, spread_decay, float, NONE) \
                P(class, prefix, spread_max, float, NONE) \
                P(class, prefix, spread_min, float, NONE) \
+               P(class, prefix, spread_cold_damagemultiplier, float, NONE) \
+               P(class, prefix, spread_heat_damagemultiplier, float, NONE) \
                P(class, prefix, sustained_ammo, float, NONE) \
                P(class, prefix, sustained_damage, float, NONE) \
                P(class, prefix, sustained_force, float, NONE) \