Skip to content

Commit

Permalink
Use standard Sin/Cos version (fixing "The Pit" tilting floor issue, a…
Browse files Browse the repository at this point in the history
…nd maybe other similar issues too)
  • Loading branch information
ptitSeb committed May 27, 2017
1 parent a416423 commit dce3915
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Sources/Engine/Math/Functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ double adCosQuadrants[4][2] =
{1.0, -90.0},
{1.0, 0.0},
};

/*
FLOAT Sin(ANGLE a)
{
double aWrapped = WrapAngle(a);
Expand All @@ -92,3 +92,4 @@ FLOAT Tan(ANGLE a)
{
return Sin(a)/Cos(a);
}
*/
12 changes: 9 additions & 3 deletions Sources/Engine/Math/Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,15 @@ inline FLOAT RadAngle(ANGLE aAngle) {
return FLOAT (WrapAngle(aAngle)*PI/ANGLE_180);
}

ENGINE_API FLOAT Sin(ANGLE a);
ENGINE_API FLOAT Cos(ANGLE a);
ENGINE_API FLOAT Tan(ANGLE a);
#ifdef __arm__
inline ENGINE_API FLOAT Sin(ANGLE a) { return sinf(a*(PI/ANGLE_180)); };
inline ENGINE_API FLOAT Cos(ANGLE a) { return cosf(a*(PI/ANGLE_180)); };
inline ENGINE_API FLOAT Tan(ANGLE a) { return tanf(a*(PI/ANGLE_180)); };
#else
inline ENGINE_API FLOAT Sin(ANGLE a) { return sin(a*(PI/ANGLE_180)); };
inline ENGINE_API FLOAT Cos(ANGLE a) { return cos(a*(PI/ANGLE_180)); };
inline ENGINE_API FLOAT Tan(ANGLE a) { return tan(a*(PI/ANGLE_180)); };
#endif

#ifdef __arm__
inline ENGINE_API FLOAT SinFast(ANGLE a) { return sinf(a*(PI/ANGLE_180)); };
Expand Down

4 comments on commit dce3915

@sum01
Copy link

@sum01 sum01 commented on dce3915 Jul 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you don't have an issue tracker, I can only put this here...
Assertion failure at DestroyableInactive (serious-engine-git/src/Serious-Engine/Sources/EntitiesMP/EnemySpawner.es:419), triggered 1 time: '0'
From this thread where someone was requesting a PKGBUILD to install the Serious Engine on Arch-Linux. Here's the PKGBUILD in question, which builds/installs fine as far as I'm aware.

@ptitSeb
Copy link
Owner Author

@ptitSeb ptitSeb commented on dce3915 Jul 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with the PKGBUILD process, but:

  1. be sure to use separate build tree for TSE and TFE, as there are some common file compiled, but with different define.
  2. be sure to build a Release build, not a Debug one, as the debug build assert a lot.
  3. I don't think SeriousEngine is 64bits clean yet. In any case, be sure to not use ASM when building on 64bits. If possible, prefer 32bits build. I haven't tested much 64bits build. It start IIRC, but not sure it's playable.

(Shall I activate issue tracker on github?).

@sum01
Copy link

@sum01 sum01 commented on dce3915 Jul 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be sure to use separate build tree for TSE and TFE, as there are some common file compiled, but with different define.

I'm running rm -rf cmake-build between TSE and TFE builds, I assumed that would be enough?

be sure to build a Release build, not a Debug one, as the debug build assert a lot.

Thanks, will switch to Release.

I don't think SeriousEngine is 64bits clean yet. In any case, be sure to not use ASM when building on 64bits. If possible, prefer 32bits build. I haven't tested much 64bits build. It start IIRC, but not sure it's playable.

I'm just using the AMD64 line on the cmake (the one not commented out). Is that incorrect?

@ptitSeb
Copy link
Owner Author

@ptitSeb ptitSeb commented on dce3915 Jul 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cleaning looks fine yes.

About 64bits, I know it build fine on 64bits. The point is, I'm not sure it does run on 64bits (last time I tried, it didn't, but it was at the beginning of the OpenSource Linux port, so it may be better).
Let's say 64bits is for advanced user and may crash.
32bits build should be rock solid (once built in release).

(I have activate the issue tracker for this repo)

Please sign in to comment.