From: terencehill <piuntn@gmail.com>
Date: Fri, 4 Oct 2024 10:30:45 +0000 (+0200)
Subject: Simplify it.tur_head.aim_speed calculation; also remove a few outdated comments and... 
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=90b8d3070381bdbfe34b3aa1cb818aadc309e859;p=xonotic%2Fxonotic-data.pk3dir.git

Simplify it.tur_head.aim_speed calculation; also remove a few outdated comments and fix some inconsistent style in turret code
---

diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc
index d8e2e9af26..cc9700c0a9 100644
--- a/qcsrc/common/turrets/sv_turrets.qc
+++ b/qcsrc/common/turrets/sv_turrets.qc
@@ -11,7 +11,6 @@
 // Generic aiming
 vector turret_aim_generic(entity this)
 {
-
 	vector pre_pos, prep;
 	float distance, impact_time = 0, i, mintime;
 
@@ -67,7 +66,7 @@ vector turret_aim_generic(entity this)
 	return pre_pos;
 }
 
-float turret_targetscore_support(entity _turret,entity _target)
+float turret_targetscore_support(entity _turret, entity _target)
 {
 	float score;		// Total score
 	float s_score = 0, d_score;
@@ -183,7 +182,7 @@ void turret_die(entity this)
 	this.deadflag		  = DEAD_DEAD;
 	this.tur_head.deadflag = this.deadflag;
 
-// Unsolidify and hide real parts
+	// Unsolidify and hide real parts
 	this.solid			 = SOLID_NOT;
 	this.tur_head.solid	 = this.solid;
 
@@ -193,7 +192,7 @@ void turret_die(entity this)
 
 	SetResourceExplicit(this, RES_HEALTH, 0);
 
-// Go boom
+	// Go boom
 	//RadiusDamage (this,this, min(this.ammo,50),min(this.ammo,50) * 0.25,250,NULL,min(this.ammo,50)*5,DEATH_TURRET,NULL);
 
 	Turret tur = get_turretinfo(this.m_id);
@@ -319,7 +318,7 @@ void turrets_setframe(entity this, float _frame, float client_only)
 		this.anim_start_time = time;
 	}
 
-	 if(client_only)
+	if(client_only)
 		this.clientframe = _frame;
 	else
 		this.frame = _frame;
@@ -427,7 +426,6 @@ void load_unit_settings(entity ent, bool is_reload)
 
 void turret_projectile_explode(entity this)
 {
-
 	this.takedamage = DAMAGE_NO;
 	this.event_damage = func_null;
 #ifdef TURRET_DEBUG
@@ -572,10 +570,10 @@ void turret_track(entity this)
 	switch(this.track_type)
 	{
 		case TFL_TRACKTYPE_STEPMOTOR:
-			f_tmp = this.aim_speed * frametime; // dgr/sec -> dgr/tic
+			f_tmp = this.aim_speed * frametime;
 			if (this.track_flags & TFL_TRACK_PITCH)
 			{
-				this.tur_head.angles_x += bound(-f_tmp,move_angle_x, f_tmp);
+				this.tur_head.angles_x += bound(-f_tmp, move_angle_x, f_tmp);
 				if(this.tur_head.angles_x > this.aim_maxpitch)
 					this.tur_head.angles_x = this.aim_maxpitch;
 
@@ -599,7 +597,7 @@ void turret_track(entity this)
 			return;
 
 		case TFL_TRACKTYPE_FLUIDINERTIA:
-			f_tmp = this.aim_speed * frametime; // dgr/sec -> dgr/tic
+			f_tmp = this.aim_speed * frametime;
 			move_angle_x = bound(-this.aim_speed, move_angle_x * this.track_accel_pitch * f_tmp, this.aim_speed);
 			move_angle_y = bound(-this.aim_speed, move_angle_y * this.track_accel_rot * f_tmp, this.aim_speed);
 			move_angle = (this.tur_head.avelocity * this.track_blendrate) + (move_angle * (1 - this.track_blendrate));
@@ -1184,7 +1182,7 @@ void turret_think(entity this)
 */
 void turret_use(entity this, entity actor, entity trigger)
 {
-	LOG_TRACE("Turret ",this.netname, " used by ", actor.classname);
+	LOG_TRACE("Turret ", this.netname, " used by ", actor.classname);
 
 	this.team = actor.team;
 
@@ -1192,7 +1190,6 @@ void turret_use(entity this, entity actor, entity trigger)
 		this.active = ACTIVE_NOT;
 	else
 		this.active = ACTIVE_ACTIVE;
-
 }
 
 void turret_link(entity this)
diff --git a/qcsrc/common/turrets/turret/ewheel.qc b/qcsrc/common/turrets/turret/ewheel.qc
index d5420aa0c1..4eed5b2308 100644
--- a/qcsrc/common/turrets/turret/ewheel.qc
+++ b/qcsrc/common/turrets/turret/ewheel.qc
@@ -73,10 +73,9 @@ void ewheel_move_enemy(entity this)
         }
         else if (this.tur_head.spawnshieldtime < 2)
         {
-
             newframe = ewheel_anim_fwd_slow;
             movelib_move_simple(this, v_forward, (autocvar_g_turrets_unit_ewheel_speed_slow), 0.4);
-       }
+        }
         else
         {
             newframe = ewheel_anim_fwd_slow;
@@ -207,9 +206,7 @@ METHOD(EWheel, tr_setup, void(EWheel this, entity it))
     it.frame					= it.tur_head.frame = 1;
     it.ammo_flags				= TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
 
-    // Convert from dgr / sec to dgr / tic
-    it.tur_head.aim_speed = (autocvar_g_turrets_unit_ewheel_turnrate);
-    it.tur_head.aim_speed = it.tur_head.aim_speed / (1 / frametime);
+    it.tur_head.aim_speed = autocvar_g_turrets_unit_ewheel_turnrate * frametime;
 }
 
 #endif // SVQC