From: Rudolf Polzer Date: Wed, 24 Nov 2010 18:48:47 +0000 (+0100) Subject: more accuracy fixes X-Git-Tag: xonotic-v0.1.0preview~108 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e0aa374449ed8b7455450f339c9143854b073bb2;p=xonotic%2Fxonotic-data.pk3dir.git more accuracy fixes --- diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 40bed8d10..0bcb9c46d 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -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; } } } diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 82a45b713..65f36cf7a 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -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; diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index b1be9dc2a..5f4c64eee 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -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 diff --git a/qcsrc/server/accuracy.qc b/qcsrc/server/accuracy.qc index c2a68d723..783c0aceb 100644 --- a/qcsrc/server/accuracy.qc +++ b/qcsrc/server/accuracy.qc @@ -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; diff --git a/qcsrc/server/accuracy.qh b/qcsrc/server/accuracy.qh index afdc46a5a..f68387648 100644 --- a/qcsrc/server/accuracy.qh +++ b/qcsrc/server/accuracy.qh @@ -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); diff --git a/qcsrc/server/w_campingrifle.qc b/qcsrc/server/w_campingrifle.qc index 07268a7a0..4a1919d23 100644 --- a/qcsrc/server/w_campingrifle.qc +++ b/qcsrc/server/w_campingrifle.qc @@ -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); diff --git a/qcsrc/server/w_common.qc b/qcsrc/server/w_common.qc index 25ca2f5c6..600f260f4 100644 --- a/qcsrc/server/w_common.qc +++ b/qcsrc/server/w_common.qc @@ -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; diff --git a/qcsrc/server/w_crylink.qc b/qcsrc/server/w_crylink.qc index b688a9f7f..5bd58554f 100644 --- a/qcsrc/server/w_crylink.qc +++ b/qcsrc/server/w_crylink.qc @@ -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; diff --git a/qcsrc/server/w_laser.qc b/qcsrc/server/w_laser.qc index 79d782c95..022788adc 100644 --- a/qcsrc/server/w_laser.qc +++ b/qcsrc/server/w_laser.qc @@ -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) diff --git a/qcsrc/server/w_seeker.qc b/qcsrc/server/w_seeker.qc index b74f60e00..3e479f621 100644 --- a/qcsrc/server/w_seeker.qc +++ b/qcsrc/server/w_seeker.qc @@ -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; diff --git a/qcsrc/server/w_shotgun.qc b/qcsrc/server/w_shotgun.qc index 3efb0e973..573fb1206 100644 --- a/qcsrc/server/w_shotgun.qc +++ b/qcsrc/server/w_shotgun.qc @@ -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(); diff --git a/qcsrc/server/w_uzi.qc b/qcsrc/server/w_uzi.qc index 676f64f78..4f8583614 100644 --- a/qcsrc/server/w_uzi.qc +++ b/qcsrc/server/w_uzi.qc @@ -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;