summaryrefslogtreecommitdiffhomepage
path: root/Stars45/StarSystem.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-10-02 21:34:32 +0200
committerAki <please@ignore.pl>2021-10-02 21:34:32 +0200
commitd2fc3ad2272f7cc850ef95fbe803c10e8746ad86 (patch)
tree988f56af14d52ff2452ea7bb2da06a11736afa39 /Stars45/StarSystem.cpp
parent03bdf9c0fe25d3d9e765c13a2d18048088c3a3a0 (diff)
downloadstarshatter-d2fc3ad2272f7cc850ef95fbe803c10e8746ad86.zip
starshatter-d2fc3ad2272f7cc850ef95fbe803c10e8746ad86.tar.gz
starshatter-d2fc3ad2272f7cc850ef95fbe803c10e8746ad86.tar.bz2
Switched to long doubles instead of doing manual FPU manipulation
Diffstat (limited to 'Stars45/StarSystem.cpp')
-rw-r--r--Stars45/StarSystem.cpp35
1 files changed, 7 insertions, 28 deletions
diff --git a/Stars45/StarSystem.cpp b/Stars45/StarSystem.cpp
index 8daed31..3c91f99 100644
--- a/Stars45/StarSystem.cpp
+++ b/Stars45/StarSystem.cpp
@@ -54,34 +54,17 @@
#include "Scene.h"
#include "ParseUtil.h"
-const double epoch = 0.5e9;
-double StarSystem::stardate = 0;
+const long double epoch = 0.5e9;
+long double StarSystem::stardate = 0;
// +====================================================================+
-static double base_time = 0;
+static long double base_time = 0;
static WORD oldcw = 0;
static WORD fpcw = 0;
-void FPU2Extended()
+void StarSystem::SetBaseTime(long double t, bool absolute)
{
- _asm { fstcw oldcw }
- fpcw = oldcw | 0x0300; // set 80-bit precision mode
- _asm { fldcw fpcw }
-}
-
-void FPURestore()
-{
- // well, I don't actually WANT single-precision mode
- // so I think I'll just ignore this...
-
- //_asm { fldcw oldcw }
-}
-
-void StarSystem::SetBaseTime(double t, bool absolute)
-{
- FPU2Extended();
-
if (absolute) {
base_time = t;
CalcStardate();
@@ -94,7 +77,7 @@ void StarSystem::SetBaseTime(double t, bool absolute)
}
}
-double StarSystem::GetBaseTime()
+long double StarSystem::GetBaseTime()
{
return base_time;
}
@@ -111,14 +94,10 @@ void StarSystem::CalcStardate()
base_time += epoch;
}
- FPU2Extended();
-
- double gtime = (double) Game::GameTime() / 1000.0;
- double sdate = gtime + base_time + epoch;
+ long double gtime = (long double) Game::GameTime() / 1000.0;
+ long double sdate = gtime + base_time + epoch;
stardate = sdate;
-
- FPURestore();
}
static const double GRAV = 6.673e-11;