Include lots of forgotten math.h and roundf() is included in C99.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3586 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
76fddad000
commit
9f9c417240
|
@ -33,13 +33,15 @@
|
|||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
static inline int math_round(float x)
|
||||
#if !defined(WZ_C99)
|
||||
static inline int roundf(float x)
|
||||
{
|
||||
// Ensure that float truncation results in a proper rounding
|
||||
if (x < 0.f)
|
||||
if (x < 0.0f)
|
||||
return x - 0.5f;
|
||||
else
|
||||
return x + 0.5f;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __INCLUDED_LIB_FRAMEWORK_MATH_HELP_H__
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "debug.h"
|
||||
#include "trig.h"
|
||||
|
@ -52,7 +55,7 @@ static float aSqrt[SQRT_ACCURACY];
|
|||
/* Initialise the Trig tables */
|
||||
BOOL trigInitialise(void)
|
||||
{
|
||||
float val = 0.0f, inc = 2.0f * (float)M_PI / TRIG_DEGREES;
|
||||
float val = 0.0f, inc = 2.0f * M_PI / TRIG_DEGREES;
|
||||
int i;
|
||||
|
||||
// Initialise the tables
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "lib/framework/wzglobal.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#if defined(WZ_CC_MSVC)
|
||||
// Prevent nasty "nonstandard extension used : non-constant aggregate initializer" warning when using MSVC
|
||||
# pragma warning(disable:4204)
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include <physfs.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "tracklib.h"
|
||||
#include "audio.h"
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
|
||||
// ------------------------------------------------------------------------------------
|
||||
#include "lib/framework/frame.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "difficulty.h"
|
||||
// ------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -91,8 +94,8 @@ DIFFICULTY_LEVEL getDifficultyLevel( void )
|
|||
int modifyForDifficultyLevel(int basicVal, bool IsPlayer)
|
||||
{
|
||||
if (IsPlayer)
|
||||
return math_round(basicVal * fDifPlayerModifier);
|
||||
return roundf(basicVal * fDifPlayerModifier);
|
||||
else
|
||||
return math_round(basicVal * fDifEnemyModifier);
|
||||
return roundf(basicVal * fDifEnemyModifier);
|
||||
}
|
||||
// ------------------------------------------------------------------------------------
|
||||
|
|
|
@ -1168,9 +1168,9 @@ void scroll(void)
|
|||
sine = sinf(radians);
|
||||
|
||||
/* Get x component of movement */
|
||||
xDif = math_round(cosine * scrollStepLeftRight + sine * scrollStepUpDown);
|
||||
xDif = roundf(cosine * scrollStepLeftRight + sine * scrollStepUpDown);
|
||||
/* Get y component of movement */
|
||||
yDif = math_round(sine * scrollStepLeftRight - cosine * scrollStepUpDown);
|
||||
yDif = roundf(sine * scrollStepLeftRight - cosine * scrollStepUpDown);
|
||||
|
||||
/* Adjust player's position by these components */
|
||||
player.p.x += xDif;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "lib/framework/frame.h"
|
||||
#include "lib/framework/strres.h"
|
||||
#include "lib/framework/math-help.h"
|
||||
#include "lib/widget/widget.h"
|
||||
#include "lib/ivis_common/textdraw.h"
|
||||
|
||||
|
@ -584,7 +585,7 @@ BOOL intAddTransButtonForm(void)
|
|||
|
||||
if (sFormInit.numMajor > MAX_TAB_STD_SHOWN)
|
||||
{ // we do NOT use smallTab icons here, so be safe and only display max # of
|
||||
// standard sized tab icons.
|
||||
// standard sized tab icons.
|
||||
sFormInit.numMajor = MAX_TAB_STD_SHOWN;
|
||||
}
|
||||
//set minor tabs to 1
|
||||
|
|
Loading…
Reference in New Issue