]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 40bed8d103ec56ad07561bed2a814286475bec1a..0bcb9c46d3e5c27620f944e2930d90f9572a5cda 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 82a45b7138f707cac89ca81e89054827505b6bbf..65f36cf7a0af360cd84cb5bd170e47c2fee397ce 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 b1be9dc2a4dcc7e1b24e84c5cde75c1e4439b4c9..5f4c64eee924ebdd8ace1bb7329c84199cd63ec5 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 c2a68d723eb0081e4d1e0464d315b69b1f1e6942..783c0aceb68648eb3123dbff07c34cfd13c429af 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 afdc46a5acc8a56f2a81746a1618c37f7c45c556..f683876485d97829d00b254bf393a89f1acfd3bc 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 07268a7a0fae0c9efa3389f494f7cb4776b33906..4a1919d23a4cc428b6984e668ade514013d1fcf0 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 25ca2f5c6225058f2e410bdf8382f35d160c216e..600f260f434c212c4b99e0bd830cf5653b68703b 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 b688a9f7f5d7a04e264550d900edfce7dc1d624b..5bd58554f783a99440cac0c4097c86b1786d8c77 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 79d782c95ce51a9af4ff579e276ac96a9b01b27c..022788adc04a8a4ccdce7b33f0d8aee02741e88e 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 b74f60e00e28437bb33ab7f016443640bfb134dc..3e479f621976cf52efb26270bb031cecd4b1c4a0 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 3efb0e97320a278571a5c672c6528bc93c212eb9..573fb12068f04a84206e90642dd41e2996752fce 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 676f64f780d1fd42bfd09d4afbc80bda75bf9a7c..4f85836149c7adadd54aee8f871b08642631b3b4 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;