From 48be3f7022f5d5a264d713af3978da20f0ac1da2 Mon Sep 17 00:00:00 2001
From: Randy Heit <rheit@zdoom.fake>
Date: Thu, 18 Dec 2008 06:22:18 +0000
Subject: [PATCH] - Fixed: Thing_ProjectileIntercept broke slightly when
 converted to the new   vector math routines (almost two years ago!) because
 the original code   multiplied down columns of the rotation matrix, but the
 new code multiplies   across rows of the matrix instead. This is remedied by
 flipping the matrix   across the x=y axis by reversing the sign of the sine
 value passed to the   matrix constructor.

SVN r1324 (trunk)
---
 docs/rh-log.txt  | 8 ++++++++
 src/p_things.cpp | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/docs/rh-log.txt b/docs/rh-log.txt
index 8bddbe966..cad6765ee 100644
--- a/docs/rh-log.txt
+++ b/docs/rh-log.txt
@@ -1,3 +1,11 @@
+December 17, 2008
+- Fixed: Thing_ProjectileIntercept broke slightly when converted to the new
+  vector math routines (almost two years ago!) because the original code
+  multiplied down columns of the rotation matrix, but the new code multiplies
+  across rows of the matrix instead. This is remedied by flipping the matrix
+  across the x=y axis by reversing the sign of the sine value passed to the
+  matrix constructor.
+
 December 15, 2008
 - Fixed: Autoloading a game (e.g. respawning after dying in single player)
   during demo playback prematurely ended demo control of the player.
diff --git a/src/p_things.cpp b/src/p_things.cpp
index dc4690da1..b8273db57 100644
--- a/src/p_things.cpp
+++ b/src/p_things.cpp
@@ -173,7 +173,7 @@ bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog)
 	return false;
 }
 
-bool P_Thing_Projectile (int tid, AActor *source, int type, const char * type_name, angle_t angle,
+bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_name, angle_t angle,
 	fixed_t speed, fixed_t vspeed, int dest, AActor *forcedest, int gravity, int newtid,
 	bool leadTarget)
 {
@@ -288,7 +288,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char * type_na
 							double ydotx = -aim | tvel;
 							double a = acos (clamp (ydotx / targspeed / dist, -1.0, 1.0));
 							double multiplier = double(pr_leadtarget.Random2())*0.1/255+1.1;
-							double sinb = clamp (targspeed*multiplier * sin(a) / fspeed, -1.0, 1.0);
+							double sinb = -clamp (targspeed*multiplier * sin(a) / fspeed, -1.0, 1.0);
 
 							// Use the cross product of two of the triangle's sides to get a
 							// rotation vector.