shithub: cstory

Download patch

ref: cfcee6d4c34564428fbe39a191f20eddc8182036
parent: f8f46fc1e422219a216d8ab7ebbe34f76c52bc87
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Apr 8 12:57:20 EDT 2019

Made Triangle.cpp ASM-accurate

--- a/src/Triangle.cpp
+++ b/src/Triangle.cpp
@@ -9,6 +9,8 @@
 void InitTriangleTable()
 {
 	int i;
+	float a;
+	float b;
 
 	//Sine
 	for (i = 0; i < 0x100; ++i)
@@ -19,9 +21,9 @@
 	//Tangent
 	for (i = 0; i < 0x21; ++i)
 	{
-		float a = (float)(i * 6.2831855 / 256.0);
-		float b = sinf(a) / cosf(a);
-		gTan[i] = (int16_t)(b * 8192.0);
+		a = (float)(i * 6.2831855f / 256.0f);
+		b = sinf(a) / cosf(a);
+		gTan[i] = (int16_t)(b * 8192.0f);
 	}
 }
 
@@ -63,7 +65,7 @@
 		}
 		else
 		{
-			if (-y < x)
+			if (x > -y)
 			{
 				k = (-y * 0x2000) / x;
 				while (k > gTan[a])