more accuracy fixes
authorRudolf Polzer <divverent@alientrap.org>
Wed, 24 Nov 2010 18:48:47 +0000 (19:48 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 24 Nov 2010 18:48:47 +0000 (19:48 +0100)
12 files changed:
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/client/scoreboard.qc
qcsrc/server/accuracy.qc
qcsrc/server/accuracy.qh
qcsrc/server/w_campingrifle.qc
qcsrc/server/w_common.qc
qcsrc/server/w_crylink.qc
qcsrc/server/w_laser.qc
qcsrc/server/w_seeker.qc
qcsrc/server/w_shotgun.qc
qcsrc/server/w_uzi.qc

index 40bed8d..0bcb9c4 100644 (file)
@@ -918,7 +918,7 @@ void Ent_ReadAccuracy(void)
                        if(b == 0)
                                weapon_accuracy[w] = -1;
                        else
-                               weapon_accuracy[w] = (b - 1.0) / 254.0;
+                               weapon_accuracy[w] = (b - 1.0) / 100.0;
                }
        }
 }
index 82a45b7..65f36cf 100644 (file)
@@ -1385,7 +1385,7 @@ void CSQC_common_hud(void)
                                                acc_levels = MAX_ACCURACY_LEVELS;
 
                                        for (i = 0; i < acc_levels; ++i)
-                                               acc_lev[i] = stof(argv(i));
+                                               acc_lev[i] = stof(argv(i)) / 100.0;
                                }
                                // let know that acc_col[] needs to be loaded
                                acc_col_x[0] = -1;
index b1be9dc..5f4c64e 100644 (file)
@@ -972,7 +972,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
                        average_accuracy += weapon_stats; // store sum of all accuracies in average_accuracy
 
                        string s;
-                       s = strcat(ftos(weapon_stats),"%");
+                       s = sprintf("%d%%", weapon_stats*100);
 
                        float padding;
                        padding = (weapon_width - stringwidth(s, FALSE, '1 0 0' * fontsize)) / 2; // center the accuracy value
index c2a68d7..783c0ac 100644 (file)
@@ -6,9 +6,10 @@ FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(accuracy_fired);
 
 float accuracy_byte(float n, float d)
 {
+       print(sprintf("accuracy: %d / %d\n", n, d));
        if(d == 0)
                return 0;
-       return 1.0 + rint(n * 254.0 / d);
+       return 1 + rint(n * 100.0 / d);
 }
 
 float accuracy_send(entity to, float sf)
@@ -60,7 +61,7 @@ void accuracy_resend(entity e)
 }
 
 // update accuracy stats
-void accuracy_set(entity e, float w, float hit, float fired)
+void accuracy_set(entity e, float w, float fired, float hit)
 {
        entity a;
        float b;
@@ -81,7 +82,7 @@ void accuracy_set(entity e, float w, float hit, float fired)
                                a.SendFlags |= w;
 }
 
-void accuracy_add(entity e, float w, float hit, float fired)
+void accuracy_add(entity e, float w, float fired, float hit)
 {
        entity a;
        float b;
index afdc46a..f683876 100644 (file)
@@ -9,8 +9,8 @@ void accuracy_free(entity e);
 void accuracy_resend(entity e);
 
 // update accuracy stats
-void accuracy_set(entity e, float w, float hit, float fired);
-void accuracy_add(entity e, float w, float hit, float fired);
+void accuracy_set(entity e, float w, float fired, float hit);
+void accuracy_add(entity e, float w, float fired, float hit);
 
 // helper
 float accuracy_isgooddamage(entity attacker, entity targ);
index 07268a7..4a1919d 100644 (file)
@@ -84,9 +84,9 @@ void W_CampingRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAdde
                self.ammo_nails -= pAmmo;
 
        if(deathtype & HITTYPE_SECONDARY)
-               W_SetupShot (self, cvar("g_antilag_bullets") && pSpeed >= cvar("g_antilag_bullets"), 2, "weapons/campingrifle_fire2.wav", cvar("g_balance_campingrifle_secondary_damage"));
+               W_SetupShot (self, cvar("g_antilag_bullets") && pSpeed >= cvar("g_antilag_bullets"), 2, "weapons/campingrifle_fire2.wav", cvar("g_balance_campingrifle_secondary_damage") + cvar("g_balance_campingrifle_secondary_headshotaddeddamage"));
        else
-               W_SetupShot (self, cvar("g_antilag_bullets") && pSpeed >= cvar("g_antilag_bullets"), 2, "weapons/campingrifle_fire.wav", cvar("g_balance_campingrifle_primary_damage"));
+               W_SetupShot (self, cvar("g_antilag_bullets") && pSpeed >= cvar("g_antilag_bullets"), 2, "weapons/campingrifle_fire.wav", cvar("g_balance_campingrifle_primary_damage") + cvar("g_balance_campingrifle_primary_headshotaddeddamage"));
 
        pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 2000, 1);
 
index 25ca2f5..600f260 100644 (file)
@@ -159,7 +159,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
 .float dmg_total;
 void W_BallisticBullet_Hit (void)
 {
-       float f, q;
+       float f, q, g;
 
        f = pow(bound(0, vlen(self.velocity) / vlen(self.oldvelocity), 1), 2); // energy multiplier
        q = 1 + self.dmg_edge / self.dmg;
@@ -173,10 +173,10 @@ void W_BallisticBullet_Hit (void)
 
                headshot = 0;
                yoda = 0;
-               damage_headshotbonus = self.dmg_edge;
+               damage_headshotbonus = self.dmg_edge * f;
                railgun_start = self.origin - 2 * frametime * self.velocity;
                railgun_end = self.origin + 2 * frametime * self.velocity;
-
+               g = accuracy_isgooddamage(self.owner, other);
                Damage(other, self, self.owner, self.dmg * f, self.projectiledeathtype, self.origin, self.dmg_force * normalize(self.velocity) * f);
                damage_headshotbonus = 0;
 
@@ -192,7 +192,7 @@ void W_BallisticBullet_Hit (void)
                        AnnounceTo(self.owner, "awesome");
 
                // calculate hits for ballistic weapons
-               if(accuracy_isgooddamage(self.owner, other))
+               if(g)
                {
                        // do not exceed 100%
                        q = min(self.dmg * q, self.dmg_total + f * self.dmg) - self.dmg_total;
index b688a9f..5bd5855 100644 (file)
@@ -317,7 +317,7 @@ void W_Crylink_Attack (void)
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
                self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
 
-       W_SetupShot (self, FALSE, 2, "weapons/crylink_fire.wav", (cvar("g_balance_crylink_primary_damage")*cvar("g_balance_crylink_primary_shots")));
+       W_SetupShot (self, FALSE, 2, "weapons/crylink_fire.wav", (cvar("g_balance_crylink_primary_damage")*cvar("g_balance_crylink_primary_shots"))); // FIXME this is wrong, crylink can do more (linkjoin, bounce damage)
        forward = v_forward;
        right = v_right;
        up = v_up;
index 79d782c..022788a 100644 (file)
@@ -229,7 +229,7 @@ float w_laser(float req)
                if (self.BUTTON_ATCK)
                if (weapon_prepareattack(0, cvar("g_balance_laser_primary_refire")))
                {
-                       W_Laser_Attack(1);
+                       W_Laser_Attack(0);
                        weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_laser_primary_animtime"), w_ready);
                }
                if (self.BUTTON_ATCK2)
index b74f60e..3e479f6 100644 (file)
@@ -164,7 +164,7 @@ void Seeker_Fire_Missile(vector f_diff)
                self.ammo_rockets = self.ammo_rockets - cvar("g_balance_seeker_missile_ammo");
 
        makevectors(self.v_angle);
-       W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/seeker_fire.wav", cvar("g_balance_seeker_missile_damage"));
+       W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/seeker_fire.wav", 0);
        w_shotorg += f_diff;
        pointparticles(particleeffectnum("seeker_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
@@ -300,7 +300,7 @@ void Seeker_Fire_Tag()
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
                self.ammo_rockets = self.ammo_rockets - cvar("g_balance_seeker_tag_ammo");
 
-       W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/tag_fire.wav", 0);
+       W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/tag_fire.wav", cvar("g_balance_seeker_missile_damage") * cvar("g_balance_seeker_missile_count"));
 
        missile                 = spawn();
        missile.owner           = self;
index 3efb0e9..573fb12 100644 (file)
@@ -22,7 +22,7 @@ void W_Shotgun_Attack (void)
        bulletspeed = cvar("g_balance_shotgun_primary_speed");
        bulletconstant = cvar("g_balance_shotgun_primary_bulletconstant");
 
-       W_SetupShot (self, cvar("g_antilag_bullets") && bulletspeed >= cvar("g_antilag_bullets"), 5, "weapons/shotgun_fire.wav", cvar("g_balance_shotgun_primary_damage"));
+       W_SetupShot (self, cvar("g_antilag_bullets") && bulletspeed >= cvar("g_antilag_bullets"), 5, "weapons/shotgun_fire.wav", d * bullets);
        for (sc = 0;sc < bullets;sc = sc + 1)
                fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, 0, f, WEP_SHOTGUN, 0, 1, bulletconstant);
        endFireBallisticBullet();
index 676f64f..4f85836 100644 (file)
@@ -50,7 +50,7 @@ void W_Uzi_Attack (float deathtype)
                else
                        self.ammo_nails = self.ammo_nails - cvar("g_balance_uzi_sustained_ammo");
        }
-       W_SetupShot (self, cvar("g_antilag_bullets") && cvar("g_balance_uzi_speed") >= cvar("g_antilag_bullets"), 0, "weapons/uzi_fire.wav", cvar("g_balance_uzi_first_damage"));
+       W_SetupShot (self, cvar("g_antilag_bullets") && cvar("g_balance_uzi_speed") >= cvar("g_antilag_bullets"), 0, "weapons/uzi_fire.wav", ((self.uzi_bulletcounter == 1) ? cvar("g_balance_uzi_first_damage") : cvar("g_balance_uzi_sustained_damage")));
        if (!g_norecoil)
        {
                self.punchangle_x = random () - 0.5;
@@ -121,7 +121,7 @@ void uzi_mode1_fire_auto()
                return;
        }
        
-       W_SetupShot (self, cvar("g_antilag_bullets") && cvar("g_balance_uzi_speed") >= cvar("g_antilag_bullets"), 0, "weapons/uzi_fire.wav", cvar("g_balance_uzi_first_damage"));
+       W_SetupShot (self, cvar("g_antilag_bullets") && cvar("g_balance_uzi_speed") >= cvar("g_antilag_bullets"), 0, "weapons/uzi_fire.wav", cvar("g_balance_uzi_sustained_damage"));
        if (!g_norecoil)
        {
                self.punchangle_x = random () - 0.5;
@@ -149,7 +149,7 @@ void uzi_mode1_fire_auto()
 
 void uzi_mode1_fire_burst()
 {
-       W_SetupShot (self, cvar("g_antilag_bullets") && cvar("g_balance_uzi_speed") >= cvar("g_antilag_bullets"), 0, "weapons/uzi_fire.wav", cvar("g_balance_uzi_first_damage"));
+       W_SetupShot (self, cvar("g_antilag_bullets") && cvar("g_balance_uzi_speed") >= cvar("g_antilag_bullets"), 0, "weapons/uzi_fire.wav", cvar("g_balance_uzi_sustained_damage"));
        if (!g_norecoil)
        {
                self.punchangle_x = random () - 0.5;