FRACT->float,[if]SQRT->sqrtf
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1658 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
7812d1635a
commit
d1d55cc977
|
@ -30,7 +30,7 @@
|
|||
// FRACTmul(fract,fract); to multiply two fract numbers
|
||||
// FRACTdiv(fract,fract); to divide two numbers
|
||||
// SQRT(fract); to get square root of a fract (returns a fract)
|
||||
// iSQRT(int); to get a square root of an integer (returns an UDWORD) (no, it does not! - Per)
|
||||
// sqrtf(int); to get a square root of an integer (returns an UDWORD) (no, it does not! - Per)
|
||||
// FRACTCONST(constA,constB); ; Generates a constant of (constA/constB)
|
||||
// e.g. to define 0.5 use FRACTCONST(1,2)
|
||||
// to define 0.114 use FRACTCONT(114,1000)
|
||||
|
@ -38,7 +38,7 @@
|
|||
// Also PERCENT(int,int); // returns a int value 0->100 of the percentage of the first param over the second
|
||||
//
|
||||
|
||||
// To multiply a FRACT by a integer just use the normal operator
|
||||
// To multiply a float by a integer just use the normal operator
|
||||
// e.g. FractValue2=FractValue*Interger;
|
||||
//
|
||||
// same is true of divide
|
||||
|
@ -60,23 +60,18 @@
|
|||
#define PERNUM(range,a,b) (((a)*range)/(b))
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
typedef float FRACT;
|
||||
typedef float FRACT_D; /* But isn't this is supposed to be double? - Per */
|
||||
|
||||
#define ROUND(x) ((x)>=0 ? (SDWORD)((x) + 0.5) : (SDWORD)((x) - 0.5))
|
||||
|
||||
#define MAKEFRACT(x) ((FRACT)(x))
|
||||
#define MAKEFRACT(x) ((float)(x))
|
||||
#define FRACTmul(x,y) ((x)*(y))
|
||||
#define FRACTdiv(x,y) ((x)/(y))
|
||||
#define FRACTmul_1(x,y) ((x)*(y))
|
||||
#define FRACTdiv_1(x,y) ((x)/(y))
|
||||
#define fSQRT(x) ((FRACT)sqrt(x))
|
||||
|
||||
// Jeremy ... the usual leg breaking rule aplies if you remove this again
|
||||
#define iSQRT(x) ((FRACT)sqrt(x))
|
||||
|
||||
#define FRACTCONST(a,b) (((float)(a)) / ((float)(b)))
|
||||
#define MAKEFRACT_D(x) ((FRACT_D)(x))
|
||||
|
|
|
@ -190,7 +190,7 @@ static inline void endian_sdword(SDWORD *sdword) {
|
|||
#endif
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
static inline void endian_fract(FRACT *fract) {
|
||||
static inline void endian_fract(float *fract) {
|
||||
UBYTE tmp, *ptr;
|
||||
|
||||
ptr = (UBYTE *) fract;
|
||||
|
|
|
@ -37,13 +37,13 @@ extern BOOL trigInitialise(void);
|
|||
extern void trigShutDown(void);
|
||||
|
||||
/* Lookup trig functions */
|
||||
extern FRACT trigSin(SDWORD angle);
|
||||
extern FRACT trigCos(SDWORD angle);
|
||||
extern FRACT trigInvSin(FRACT val);
|
||||
extern FRACT trigInvCos(FRACT val);
|
||||
extern float trigSin(SDWORD angle);
|
||||
extern float trigCos(SDWORD angle);
|
||||
extern float trigInvSin(float val);
|
||||
extern float trigInvCos(float val);
|
||||
|
||||
/* Supposedly fast lookup sqrt - unfortunately it's probably slower than the FPU sqrt :-( */
|
||||
extern FRACT trigIntSqrt(UDWORD val);
|
||||
extern float trigIntSqrt(UDWORD val);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ static inline void Vector3f_CP(Vector3f* dest, Vector3f* op1, Vector3f* op2)
|
|||
}
|
||||
|
||||
static inline void
|
||||
pie_Polygon(SDWORD numVerts, PIEVERTEX* pVrts, FRACT texture_offset, BOOL light)
|
||||
pie_Polygon(SDWORD numVerts, PIEVERTEX* pVrts, float texture_offset, BOOL light)
|
||||
{
|
||||
SDWORD i;
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ BOOL actionTargetTurret(BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, UWORD *p
|
|||
SDWORD pitchError;
|
||||
SDWORD rotationError, dx, dy, dz;
|
||||
BOOL onTarget = FALSE;
|
||||
FRACT fR;
|
||||
float fR;
|
||||
SDWORD pitchLowerLimit, pitchUpperLimit;
|
||||
DROID *psDroid = NULL;
|
||||
// Vector3i muzzle;
|
||||
|
@ -952,7 +952,7 @@ static void actionCalcPullBackPoint(BASE_OBJECT *psObj, BASE_OBJECT *psTarget, S
|
|||
// get the vector from the target to the object
|
||||
xdiff = (SDWORD)psObj->x - (SDWORD)psTarget->x;
|
||||
ydiff = (SDWORD)psObj->y - (SDWORD)psTarget->y;
|
||||
len = (SDWORD)iSQRT(xdiff*xdiff + ydiff*ydiff);
|
||||
len = (SDWORD)sqrtf(xdiff*xdiff + ydiff*ydiff);
|
||||
|
||||
if (len == 0)
|
||||
{
|
||||
|
|
|
@ -86,7 +86,7 @@ SDWORD lowerX,upperX,lowerY,upperY;
|
|||
// ------------------------------------------------------------------------------------
|
||||
static void processAVTile(UDWORD x, UDWORD y)
|
||||
{
|
||||
FRACT time;
|
||||
float time;
|
||||
MAPTILE *psTile;
|
||||
UDWORD newLevel;
|
||||
|
||||
|
@ -165,7 +165,7 @@ UDWORD i,j;
|
|||
// ------------------------------------------------------------------------------------
|
||||
UDWORD avGetObjLightLevel(BASE_OBJECT *psObj,UDWORD origLevel)
|
||||
{
|
||||
FRACT div;
|
||||
float div;
|
||||
UDWORD lowest,newLevel;
|
||||
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ APS_INACTIVE,
|
|||
} AP_STATUS;
|
||||
|
||||
ATPART asAtmosParts[MAX_ATMOS_PARTICLES];
|
||||
static FRACT fraction;
|
||||
static float fraction;
|
||||
static UDWORD freeParticle;
|
||||
static UDWORD weather;
|
||||
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
#include "difficulty.h"
|
||||
// ------------------------------------------------------------------------------------
|
||||
DIFFICULTY_LEVEL presDifLevel = DL_NORMAL;
|
||||
FRACT fDifPlayerModifier;
|
||||
FRACT fDifEnemyModifier;
|
||||
float fDifPlayerModifier;
|
||||
float fDifEnemyModifier;
|
||||
|
||||
|
||||
void setModifiers(FRACT Player,FRACT Enemy)
|
||||
void setModifiers(float Player,float Enemy)
|
||||
{
|
||||
fDifPlayerModifier = Player;
|
||||
fDifEnemyModifier = Enemy;
|
||||
|
|
|
@ -32,7 +32,7 @@ DL_KILLER
|
|||
extern void setDifficultyLevel( DIFFICULTY_LEVEL lev);
|
||||
extern DIFFICULTY_LEVEL getDifficultyLevel( void );
|
||||
extern SDWORD modifyForDifficultyLevel(SDWORD basicVal,BOOL IsPlayer);
|
||||
extern void setModifiers(FRACT Player,FRACT Enemy);
|
||||
extern void setModifiers(float Player,float Enemy);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -182,10 +182,10 @@ static UWORD RiverBedTileID = BED_TILE;
|
|||
static float waterRealValue = 0.0f;
|
||||
#define WAVE_SPEED 4
|
||||
#define MAX_FIRE_STAGE 32
|
||||
static FRACT separation=(FRACT)0;
|
||||
static float separation=(float)0;
|
||||
static SDWORD acceleration=0;
|
||||
static SDWORD heightSpeed=0;
|
||||
static FRACT aSep;
|
||||
static float aSep;
|
||||
static SDWORD aAccel = 0;
|
||||
static SDWORD aSpeed = 0;
|
||||
|
||||
|
@ -2845,7 +2845,7 @@ static void drawWeaponReloadBar(BASE_OBJECT *psObj, WEAPON *psWeap, int weapon_s
|
|||
|
||||
/* ****************/
|
||||
// display unit resistance instead of reload!
|
||||
FRACT mulH;
|
||||
float mulH;
|
||||
DROID *psDroid;
|
||||
|
||||
if (ctrlShiftDown() && (psObj->type == OBJ_DROID))
|
||||
|
@ -2982,7 +2982,7 @@ UDWORD i;
|
|||
BASE_OBJECT *psClickedOn;
|
||||
BOOL bMouseOverStructure = FALSE;
|
||||
BOOL bMouseOverOwnStructure = FALSE;
|
||||
FRACT mulH;
|
||||
float mulH;
|
||||
|
||||
psClickedOn = mouseTarget();
|
||||
if(psClickedOn!=NULL && psClickedOn->type == OBJ_STRUCTURE)
|
||||
|
@ -3319,7 +3319,7 @@ static void drawDroidSelections( void )
|
|||
BOOL bBeingTracked;
|
||||
UDWORD i,index;
|
||||
FEATURE *psFeature;
|
||||
FRACT mulH;
|
||||
float mulH;
|
||||
|
||||
psClickedOn = mouseTarget();
|
||||
if(psClickedOn!=NULL && psClickedOn->type == OBJ_DROID)
|
||||
|
@ -4596,25 +4596,25 @@ UDWORD getSuggestedPitch( void )
|
|||
// -------------------------------------------------------------------------------------
|
||||
static void trackHeight( SDWORD desiredHeight )
|
||||
{
|
||||
FRACT fraction;
|
||||
float fraction;
|
||||
UDWORD pitch;
|
||||
SDWORD angConcern;
|
||||
UDWORD desPitch;
|
||||
|
||||
/* What fraction of a second did last game loop take */
|
||||
fraction = (MAKEFRACT(frameTime2) / (FRACT)GAME_TICKS_PER_SEC);
|
||||
fraction = (MAKEFRACT(frameTime2) / (float)GAME_TICKS_PER_SEC);
|
||||
|
||||
/* How far are we from desired hieght? */
|
||||
separation = (FRACT)(desiredHeight - player.p.y);
|
||||
separation = (float)(desiredHeight - player.p.y);
|
||||
|
||||
/* Work out accelertion... */
|
||||
acceleration = MAKEINT(((ACCEL_CONSTANT*2)*separation - (VELOCITY_CONSTANT)*(FRACT)heightSpeed));
|
||||
acceleration = MAKEINT(((ACCEL_CONSTANT*2)*separation - (VELOCITY_CONSTANT)*(float)heightSpeed));
|
||||
|
||||
/* ...and now speed */
|
||||
heightSpeed += MAKEINT(((FRACT)acceleration * fraction));
|
||||
heightSpeed += MAKEINT(((float)acceleration * fraction));
|
||||
|
||||
/* Adjust the height accordingly */
|
||||
player.p.y += MAKEINT(((FRACT)heightSpeed * fraction));
|
||||
player.p.y += MAKEINT(((float)heightSpeed * fraction));
|
||||
|
||||
/* Now do auto pitch as well, but only if we're not using mouselook and not tracking */
|
||||
if(!getWarCamStatus() && !getRotActive())
|
||||
|
@ -4647,19 +4647,19 @@ UDWORD desPitch;
|
|||
else if(pitch>desPitch)
|
||||
{
|
||||
angConcern = DEG(360-pitch);
|
||||
aSep = (FRACT)(angConcern-player.r.x);
|
||||
aAccel = MAKEINT((((ACCEL_CONSTANT))*aSep - (VELOCITY_CONSTANT)*(FRACT)aSpeed));
|
||||
aSpeed += MAKEINT(((FRACT)aAccel * fraction));
|
||||
player.r.x += MAKEINT(((FRACT)aSpeed * fraction));
|
||||
aSep = (float)(angConcern-player.r.x);
|
||||
aAccel = MAKEINT((((ACCEL_CONSTANT))*aSep - (VELOCITY_CONSTANT)*(float)aSpeed));
|
||||
aSpeed += MAKEINT(((float)aAccel * fraction));
|
||||
player.r.x += MAKEINT(((float)aSpeed * fraction));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Else, move towards player's last selected pitch */
|
||||
angConcern = DEG(360-desPitch);
|
||||
aSep = (FRACT)(angConcern-player.r.x);
|
||||
aAccel = MAKEINT((((ACCEL_CONSTANT))*aSep - (VELOCITY_CONSTANT)*(FRACT)aSpeed));
|
||||
aSpeed += MAKEINT(((FRACT)aAccel * fraction));
|
||||
player.r.x += MAKEINT(((FRACT)aSpeed * fraction));
|
||||
aSep = (float)(angConcern-player.r.x);
|
||||
aAccel = MAKEINT((((ACCEL_CONSTANT))*aSep - (VELOCITY_CONSTANT)*(float)aSpeed));
|
||||
aSpeed += MAKEINT(((float)aAccel * fraction));
|
||||
player.r.x += MAKEINT(((float)aSpeed * fraction));
|
||||
}
|
||||
|
||||
// flushConsoleMessages();
|
||||
|
|
10
src/droid.c
10
src/droid.c
|
@ -1862,15 +1862,15 @@ BOOL droidUpdateBuild(DROID *psDroid)
|
|||
{
|
||||
for (j = 0; j < psStruct->pStructureType->baseBreadth+1; j++)
|
||||
{
|
||||
FRACT divisor,illumin, currentIllumin;
|
||||
float divisor,illumin, currentIllumin;
|
||||
|
||||
divisor = (FOUNDATION_ILLUMIN + prev -
|
||||
(FOUNDATION_ILLUMIN * prev)/(FRACT)100) / (FRACT)100;
|
||||
(FOUNDATION_ILLUMIN * prev)/(float)100) / (float)100;
|
||||
//work out what the initial value was before modifier was applied
|
||||
currentIllumin = mapTile(mapX+i, mapY+j)->illumination;
|
||||
illumin = currentIllumin / divisor;
|
||||
divisor = ( FOUNDATION_ILLUMIN+current-(FOUNDATION_ILLUMIN*current)/(FRACT)100 )
|
||||
/ (FRACT)100;
|
||||
divisor = ( FOUNDATION_ILLUMIN+current-(FOUNDATION_ILLUMIN*current)/(float)100 )
|
||||
/ (float)100;
|
||||
illumin = illumin * divisor;
|
||||
mapTile(mapX+i, mapY+j)->illumination = (UBYTE)illumin;
|
||||
}
|
||||
|
@ -2480,7 +2480,7 @@ void droidUpdateRecoil( DROID *psDroid )
|
|||
{
|
||||
UDWORD percent;
|
||||
UDWORD recoil;
|
||||
FRACT fraction;
|
||||
float fraction;
|
||||
//Watermelon:added multiple weapon update
|
||||
UBYTE i = 0;
|
||||
UBYTE num_weapons = 0;
|
||||
|
|
|
@ -197,7 +197,7 @@ UDWORD EffectGetNumFrames(EFFECT *psEffect);
|
|||
UDWORD IMDGetNumFrames(iIMDShape *Shape);
|
||||
|
||||
/* The fraction of a second that the last game frame took */
|
||||
static FRACT fraction;
|
||||
static float fraction;
|
||||
|
||||
static void killEffect(EFFECT *e)
|
||||
{
|
||||
|
@ -912,7 +912,7 @@ void updateExplosion(EFFECT *psEffect)
|
|||
LIGHT light;
|
||||
UDWORD percent;
|
||||
UDWORD range;
|
||||
FRACT scaling;
|
||||
float scaling;
|
||||
|
||||
if(TEST_LIT(psEffect))
|
||||
{
|
||||
|
@ -1105,7 +1105,7 @@ void updatePolySmoke(EFFECT *psEffect)
|
|||
*/
|
||||
void updateGraviton(EFFECT *psEffect)
|
||||
{
|
||||
FRACT accel;
|
||||
float accel;
|
||||
Vector3i dv;
|
||||
UDWORD groundHeight;
|
||||
MAPTILE *psTile;
|
||||
|
@ -1189,9 +1189,9 @@ void updateGraviton(EFFECT *psEffect)
|
|||
}
|
||||
|
||||
/* Spin it round a bit */
|
||||
psEffect->rotation.x += MAKEINT(((FRACT)psEffect->spin.x) * fraction);
|
||||
psEffect->rotation.y += MAKEINT(((FRACT)psEffect->spin.y) * fraction);
|
||||
psEffect->rotation.z += MAKEINT(((FRACT)psEffect->spin.z) * fraction);
|
||||
psEffect->rotation.x += MAKEINT(((float)psEffect->spin.x) * fraction);
|
||||
psEffect->rotation.y += MAKEINT(((float)psEffect->spin.y) * fraction);
|
||||
psEffect->rotation.z += MAKEINT(((float)psEffect->spin.z) * fraction);
|
||||
|
||||
/* Update velocity (and retarding of descent) according to present frame rate */
|
||||
accel = (GRAVITON_GRAVITY*fraction);
|
||||
|
@ -1224,9 +1224,9 @@ void updateGraviton(EFFECT *psEffect)
|
|||
psEffect->specific++;
|
||||
/* Half it's velocity */
|
||||
|
||||
// psEffect->velocity.x/=(FRACT)(2);
|
||||
psEffect->velocity.y/=(FRACT)(-2); // only y gets flipped
|
||||
// psEffect->velocity.z/=(FRACT)(2);
|
||||
// psEffect->velocity.x/=(float)(2);
|
||||
psEffect->velocity.y/=(float)(-2); // only y gets flipped
|
||||
// psEffect->velocity.z/=(float)(2);
|
||||
|
||||
/* Set it at ground level - may have gone through */
|
||||
psEffect->position.y = MAKEFRACT(groundHeight);
|
||||
|
@ -1263,7 +1263,7 @@ void updateDestruction(EFFECT *psEffect)
|
|||
LIGHT light;
|
||||
UDWORD percent;
|
||||
UDWORD range;
|
||||
FRACT div;
|
||||
float div;
|
||||
UDWORD height;
|
||||
|
||||
percent = PERCENT(gameTime-psEffect->birthTime,psEffect->lifeSpan);
|
||||
|
@ -1726,7 +1726,7 @@ void renderDestructionEffect(EFFECT *psEffect)
|
|||
{
|
||||
Vector3i dv;
|
||||
SDWORD rx,rz;
|
||||
FRACT div;
|
||||
float div;
|
||||
SDWORD percent;
|
||||
//SDWORD centreX,centreZ;
|
||||
UDWORD brightness,specular;
|
||||
|
|
|
@ -122,7 +122,7 @@ typedef enum
|
|||
|
||||
#define MAX_EFFECTS 500
|
||||
|
||||
#define GRAVITON_GRAVITY ((FRACT)-800)
|
||||
#define GRAVITON_GRAVITY ((float)-800)
|
||||
#define EFFECT_X_FLIP 0x1
|
||||
#define EFFECT_Y_FLIP 0x2
|
||||
#define EFFECT_CYCLIC 0x4
|
||||
|
|
|
@ -60,9 +60,9 @@ typedef struct environ_data
|
|||
{
|
||||
UBYTE bProcess;
|
||||
UBYTE type;
|
||||
FRACT val;
|
||||
float val;
|
||||
UBYTE data;
|
||||
FRACT vec;
|
||||
float vec;
|
||||
}ENVIRON_DATA;
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
|
@ -132,12 +132,12 @@ void environUpdate( void )
|
|||
{
|
||||
UDWORD i,j;
|
||||
UDWORD index;
|
||||
FRACT value,newValue;
|
||||
FRACT increment = 0;
|
||||
FRACT lowest = 0;
|
||||
FRACT highest = 0;
|
||||
float value,newValue;
|
||||
float increment = 0;
|
||||
float lowest = 0;
|
||||
float highest = 0;
|
||||
UDWORD startX,startY,endX,endY;
|
||||
FRACT fraction;
|
||||
float fraction;
|
||||
|
||||
//at the moment this function is getting called between levels and so crashes - quick check here for now
|
||||
if (pEnvironData == NULL)
|
||||
|
|
|
@ -653,7 +653,7 @@ PATH_POINT *Movement;
|
|||
UDWORD timeSoFar;
|
||||
SDWORD xDif,yDif;
|
||||
UDWORD tarX,tarY;
|
||||
FRACT fraction;
|
||||
float fraction;
|
||||
|
||||
#ifdef DEBUG
|
||||
// gameTimeStop();
|
||||
|
@ -782,9 +782,9 @@ FRACT fraction;
|
|||
|
||||
UDWORD calcJourney(UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, UDWORD speed)
|
||||
{
|
||||
FRACT xDif,yDif;
|
||||
FRACT eta;
|
||||
FRACT length;
|
||||
float xDif,yDif;
|
||||
float eta;
|
||||
float length;
|
||||
|
||||
/* Get differences between start and end points */
|
||||
xDif = MAKEFRACT(abs(x1-x2));
|
||||
|
@ -792,7 +792,7 @@ FRACT length;
|
|||
|
||||
/* Find the length between these two points */
|
||||
|
||||
length = fSQRT(FRACTmul(xDif,xDif) + FRACTmul(yDif,yDif));
|
||||
length = sqrtf(FRACTmul(xDif,xDif) + FRACTmul(yDif,yDif));
|
||||
|
||||
|
||||
/* And how long should that take, given the passed in speed */
|
||||
|
|
|
@ -584,10 +584,10 @@ typedef struct _save_move_control
|
|||
SDWORD srcX,srcY,targetX,targetY;
|
||||
|
||||
/* Stuff for John's movement update */
|
||||
FRACT fx,fy; // droid location as a fract
|
||||
// FRACT dx,dy; // x and y change for current direction
|
||||
float fx,fy; // droid location as a fract
|
||||
// float dx,dy; // x and y change for current direction
|
||||
// NOTE: this is supposed to replace Speed
|
||||
FRACT speed; // Speed of motion
|
||||
float speed; // Speed of motion
|
||||
SWORD boundX,boundY; // Vector for the end of path boundary
|
||||
SWORD dir; // direction of motion (not the direction the droid is facing)
|
||||
|
||||
|
@ -5236,7 +5236,7 @@ static DROID* buildDroidFromSaveDroid(SAVE_DROID* psSaveDroid, UDWORD version)
|
|||
{
|
||||
psDroid->resistance = (SWORD)psSaveDroid->resistance;
|
||||
memcpy(&psDroid->sMove, &psSaveDroid->sMove, sizeof(SAVE_MOVE_CONTROL));
|
||||
psDroid->sMove.fz= (FRACT)psDroid->z;
|
||||
psDroid->sMove.fz= (float)psDroid->z;
|
||||
if (psDroid->sMove.psFormation != NULL)
|
||||
{
|
||||
psDroid->sMove.psFormation = NULL;
|
||||
|
|
|
@ -622,13 +622,13 @@ static SDWORD gwRouteLength(GATEWAY *psStart, GATEWAY *psEnd)
|
|||
{
|
||||
xdiff = sx - sRoute.asPos[i].x;
|
||||
ydiff = sy - sRoute.asPos[i].y;
|
||||
dist += (SDWORD)iSQRT(xdiff*xdiff + ydiff*ydiff);
|
||||
dist += (SDWORD)sqrtf(xdiff*xdiff + ydiff*ydiff);
|
||||
sx = sRoute.asPos[i].x;
|
||||
sy = sRoute.asPos[i].y;
|
||||
}
|
||||
xdiff = sx - ex;
|
||||
ydiff = sy - ey;
|
||||
dist += (SDWORD)iSQRT(xdiff*xdiff + ydiff*ydiff);
|
||||
dist += (SDWORD)sqrtf(xdiff*xdiff + ydiff*ydiff);
|
||||
|
||||
fpathBlockingTile = fpathGroundBlockingTile;
|
||||
|
||||
|
|
|
@ -703,8 +703,8 @@ void kf_SystemClose( void )
|
|||
/* Zooms out from display */
|
||||
void kf_ZoomOut( void )
|
||||
{
|
||||
FRACT fraction;
|
||||
FRACT zoomInterval;
|
||||
float fraction;
|
||||
float zoomInterval;
|
||||
|
||||
fraction = MAKEFRACT(frameTime2)/GAME_TICKS_PER_SEC;
|
||||
zoomInterval = fraction * MAP_ZOOM_RATE;
|
||||
|
@ -750,8 +750,8 @@ void kf_RadarZoomOut( void )
|
|||
/* Zooms in the map */
|
||||
void kf_ZoomIn( void )
|
||||
{
|
||||
FRACT fraction;
|
||||
FRACT zoomInterval;
|
||||
float fraction;
|
||||
float zoomInterval;
|
||||
|
||||
fraction = MAKEFRACT(frameTime2)/GAME_TICKS_PER_SEC;
|
||||
zoomInterval = fraction * MAP_ZOOM_RATE;
|
||||
|
@ -813,8 +813,8 @@ void kf_ExpandScreen( void )
|
|||
/* Spins the world round left */
|
||||
void kf_RotateLeft( void )
|
||||
{
|
||||
FRACT fraction;
|
||||
FRACT rotAmount;
|
||||
float fraction;
|
||||
float rotAmount;
|
||||
|
||||
fraction = MAKEFRACT(frameTime2)/GAME_TICKS_PER_SEC;
|
||||
rotAmount = fraction * MAP_SPIN_RATE;
|
||||
|
@ -825,8 +825,8 @@ FRACT rotAmount;
|
|||
/* Spins the world right */
|
||||
void kf_RotateRight( void )
|
||||
{
|
||||
FRACT fraction;
|
||||
FRACT rotAmount;
|
||||
float fraction;
|
||||
float rotAmount;
|
||||
|
||||
fraction = MAKEFRACT(frameTime2)/GAME_TICKS_PER_SEC;
|
||||
rotAmount = fraction * MAP_SPIN_RATE;
|
||||
|
@ -841,8 +841,8 @@ FRACT rotAmount;
|
|||
/* Pitches camera back */
|
||||
void kf_PitchBack( void )
|
||||
{
|
||||
FRACT fraction;
|
||||
FRACT pitchAmount;
|
||||
float fraction;
|
||||
float pitchAmount;
|
||||
|
||||
//#ifdef ALEXM
|
||||
//SDWORD pitch;
|
||||
|
@ -882,8 +882,8 @@ FRACT pitchAmount;
|
|||
/* Pitches camera foward */
|
||||
void kf_PitchForward( void )
|
||||
{
|
||||
FRACT fraction;
|
||||
FRACT pitchAmount;
|
||||
float fraction;
|
||||
float pitchAmount;
|
||||
|
||||
fraction = MAKEFRACT(frameTime2)/GAME_TICKS_PER_SEC;
|
||||
pitchAmount = fraction * MAP_PITCH_RATE;
|
||||
|
@ -2426,7 +2426,7 @@ void kf_ToggleShadows( void )
|
|||
}
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
FRACT available_speed[] = {
|
||||
float available_speed[] = {
|
||||
FRACTCONST(1, 8),
|
||||
FRACTCONST(1, 4),
|
||||
FRACTCONST(1, 2),
|
||||
|
@ -2443,7 +2443,7 @@ unsigned int nb_available_speeds = 11;
|
|||
|
||||
void kf_SpeedUp( void )
|
||||
{
|
||||
FRACT mod;
|
||||
float mod;
|
||||
|
||||
if ( (!bMultiPlayer || (NetPlay.bComms==0) ) && !bInTutorial)
|
||||
{
|
||||
|
@ -2470,7 +2470,7 @@ void kf_SpeedUp( void )
|
|||
|
||||
void kf_SlowDown( void )
|
||||
{
|
||||
FRACT mod;
|
||||
float mod;
|
||||
|
||||
if ( (!bMultiPlayer || (NetPlay.bComms==0) ) && !bInTutorial)
|
||||
{
|
||||
|
|
10
src/map.c
10
src/map.c
|
@ -115,7 +115,7 @@ typedef struct _zonemap_save_header {
|
|||
|
||||
|
||||
/* Floating point type for the aaLine */
|
||||
// AAFLOAT's are interchangable with the FRACT type used in fractions.h
|
||||
// AAFLOAT's are interchangable with the float type used in fractions.h
|
||||
//
|
||||
// - I couldn't bring myself to rewrite John's execellent fixed/floating point code
|
||||
//
|
||||
|
@ -271,7 +271,7 @@ BOOL mapNew(UDWORD width, UDWORD height)
|
|||
|
||||
/* Allocate a buffer for the LOS routines points */
|
||||
|
||||
/* numPoints = iSQRT(mapWidth * mapWidth + mapHeight * mapHeight) + 1;
|
||||
/* numPoints = sqrtf(mapWidth * mapWidth + mapHeight * mapHeight) + 1;
|
||||
|
||||
|
||||
|
||||
|
@ -657,7 +657,7 @@ BOOL mapLoad(char *pFileData, UDWORD fileSize)
|
|||
|
||||
/* Allocate a buffer for the LOS routines points */
|
||||
|
||||
/* numPoints = iSQRT(mapWidth * mapWidth + mapHeight * mapHeight) + 1;
|
||||
/* numPoints = sqrtf(mapWidth * mapWidth + mapHeight * mapHeight) + 1;
|
||||
|
||||
|
||||
|
||||
|
@ -1139,10 +1139,10 @@ void mapRootTblInit(void)
|
|||
pCell = aAARootTbl;
|
||||
for(nowval = AA_ZERO; nowval < AA_ONE; nowval += incval)
|
||||
{
|
||||
*pCell++ = (AAFLOAT) fSQRT( AADIV(AA_ONE, (AA_ONE + AAMUL(nowval, nowval))) );
|
||||
*pCell++ = (AAFLOAT) sqrtf( AADIV(AA_ONE, (AA_ONE + AAMUL(nowval, nowval))) );
|
||||
}
|
||||
|
||||
aAARootTbl[tablecells - 1] = (AAFLOAT) fSQRT( AA_HALF );
|
||||
aAARootTbl[tablecells - 1] = (AAFLOAT) sqrtf( AA_HALF );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
132
src/move.c
132
src/move.c
|
@ -243,12 +243,12 @@
|
|||
|
||||
|
||||
/* The current base speed for this frame and averages for the last few seconds */
|
||||
FRACT baseSpeed;
|
||||
float baseSpeed;
|
||||
#define BASE_FRAMES 10
|
||||
UDWORD baseTimes[BASE_FRAMES];
|
||||
|
||||
/* The current base turn rate */
|
||||
FRACT baseTurn;
|
||||
float baseTurn;
|
||||
|
||||
// The next object that should get the router when a lot of units are
|
||||
// in a MOVEROUTE state
|
||||
|
@ -261,14 +261,14 @@ void fillInitialView(DROID *psDroid);
|
|||
void moveUpdatePersonModel(DROID *psDroid, SDWORD speed, SDWORD direction);
|
||||
// Calculate the boundary vector
|
||||
void moveCalcBoundary(DROID *psDroid);
|
||||
/* Turn a vector into an angle - returns a FRACT (!) */
|
||||
static FRACT vectorToAngle(FRACT vx, FRACT vy);
|
||||
/* Turn a vector into an angle - returns a float (!) */
|
||||
static float vectorToAngle(float vx, float vy);
|
||||
|
||||
/* Calculate the angle between two normalised vectors */
|
||||
#define VECTOR_ANGLE(vx1,vy1, vx2,vy2) \
|
||||
trigInvCos(FRACTmul(vx1, vx2) + FRACTmul(vy1,vy2))
|
||||
|
||||
// Abbreviate some of the FRACT defines
|
||||
// Abbreviate some of the float defines
|
||||
#define MKF(x) MAKEFRACT(x)
|
||||
#define MKI(x) MAKEINT(x)
|
||||
#define Fmul(x,y) FRACTmul(x,y)
|
||||
|
@ -641,7 +641,7 @@ static SDWORD moveDirDiff(SDWORD start, SDWORD end)
|
|||
// Tell a droid to move out the way for a shuffle
|
||||
static void moveShuffleDroid(DROID *psDroid, UDWORD shuffleStart, SDWORD sx, SDWORD sy)
|
||||
{
|
||||
FRACT shuffleDir, droidDir;
|
||||
float shuffleDir, droidDir;
|
||||
DROID *psCurr;
|
||||
SDWORD xdiff,ydiff, mx,my, shuffleMag, diff;
|
||||
BOOL frontClear = TRUE, leftClear = TRUE, rightClear = TRUE;
|
||||
|
@ -650,7 +650,7 @@ static void moveShuffleDroid(DROID *psDroid, UDWORD shuffleStart, SDWORD sx, SDW
|
|||
SDWORD tarX,tarY;
|
||||
|
||||
shuffleDir = vectorToAngle(MKF(sx),MKF(sy));
|
||||
shuffleMag = (SDWORD)iSQRT(sx*sx + sy*sy);
|
||||
shuffleMag = (SDWORD)sqrtf(sx*sx + sy*sy);
|
||||
|
||||
if (shuffleMag == 0)
|
||||
{
|
||||
|
@ -898,10 +898,10 @@ void updateDroidOrientation(DROID *psDroid)
|
|||
|
||||
|
||||
/* Calculate the normalised vector between a droid and a point */
|
||||
/*void moveCalcVector(DROID *psDroid, UDWORD x, UDWORD y, FRACT *pVX, FRACT *pVY)
|
||||
/*void moveCalcVector(DROID *psDroid, UDWORD x, UDWORD y, float *pVX, float *pVY)
|
||||
{
|
||||
SDWORD dx,dy, mag;
|
||||
FRACT root;
|
||||
float root;
|
||||
|
||||
// Calc the basic vector
|
||||
dx = (SDWORD)x - (SDWORD)psDroid->x;
|
||||
|
@ -909,16 +909,16 @@ void updateDroidOrientation(DROID *psDroid)
|
|||
|
||||
// normalise
|
||||
mag = dx*dx + dy*dy;
|
||||
root = fSQRT(MAKEFRACT(mag));
|
||||
root = sqrtf(MAKEFRACT(mag));
|
||||
*pVX = FRACTdiv(dx, root);
|
||||
*pVY = FRACTdiv(dy, root);
|
||||
}*/
|
||||
|
||||
|
||||
/* Turn a vector into an angle - returns a FRACT (!) */
|
||||
static FRACT vectorToAngle(FRACT vx, FRACT vy)
|
||||
/* Turn a vector into an angle - returns a float (!) */
|
||||
static float vectorToAngle(float vx, float vy)
|
||||
{
|
||||
FRACT angle; // Angle in degrees (0->360)
|
||||
float angle; // Angle in degrees (0->360)
|
||||
|
||||
angle = (float)(TRIG_DEGREES * atan2(-vy,vx) / M_PI / 2);
|
||||
angle += TRIG_DEGREES/4;
|
||||
|
@ -939,9 +939,9 @@ static FRACT vectorToAngle(FRACT vx, FRACT vy)
|
|||
|
||||
|
||||
/* Calculate the change in direction given a target angle and turn rate */
|
||||
static void moveCalcTurn(FRACT *pCurr, FRACT target, UDWORD rate)
|
||||
static void moveCalcTurn(float *pCurr, float target, UDWORD rate)
|
||||
{
|
||||
FRACT diff, change;
|
||||
float diff, change;
|
||||
#ifdef DEBUG //Ugh. If your gonna ONLY use this variable in "DEBUG", then
|
||||
SDWORD path=0; //make sure you wrap the function that uses it also!
|
||||
#define SET_PATH(x) path=x
|
||||
|
@ -1153,7 +1153,7 @@ static SDWORD moveObjRadius(BASE_OBJECT *psObj)
|
|||
|
||||
|
||||
// see if a Droid has run over a person
|
||||
static void moveCheckSquished(DROID *psDroid, FRACT mx,FRACT my)
|
||||
static void moveCheckSquished(DROID *psDroid, float mx,float my)
|
||||
{
|
||||
SDWORD i, droidR, rad, radSq;
|
||||
SDWORD objR;
|
||||
|
@ -1275,13 +1275,13 @@ static BOOL moveBlocked(DROID *psDroid)
|
|||
|
||||
|
||||
// Calculate the actual movement to slide around
|
||||
static void moveCalcSlideVector(DROID *psDroid,SDWORD objX, SDWORD objY, FRACT *pMx, FRACT *pMy)
|
||||
static void moveCalcSlideVector(DROID *psDroid,SDWORD objX, SDWORD objY, float *pMx, float *pMy)
|
||||
{
|
||||
SDWORD obstX, obstY;
|
||||
SDWORD absX, absY;
|
||||
SDWORD dirX, dirY, dirMag;
|
||||
FRACT mx, my, unitX,unitY;
|
||||
FRACT dotRes;
|
||||
float mx, my, unitX,unitY;
|
||||
float dotRes;
|
||||
|
||||
mx = *pMx;
|
||||
my = *pMy;
|
||||
|
@ -1327,9 +1327,9 @@ static void moveCalcSlideVector(DROID *psDroid,SDWORD objX, SDWORD objY, FRACT *
|
|||
|
||||
|
||||
// see if a droid has run into a blocking tile
|
||||
static void moveCalcBlockingSlide(DROID *psDroid, FRACT *pmx, FRACT *pmy, SDWORD tarDir, SDWORD *pSlideDir)
|
||||
static void moveCalcBlockingSlide(DROID *psDroid, float *pmx, float *pmy, SDWORD tarDir, SDWORD *pSlideDir)
|
||||
{
|
||||
FRACT mx = *pmx,my = *pmy, nx,ny;
|
||||
float mx = *pmx,my = *pmy, nx,ny;
|
||||
SDWORD tx,ty, ntx,nty; // current tile x,y and new tile x,y
|
||||
SDWORD blkCX,blkCY;
|
||||
SDWORD horizX,horizY, vertX,vertY;
|
||||
|
@ -1345,8 +1345,8 @@ static void moveCalcBlockingSlide(DROID *psDroid, FRACT *pmx, FRACT *pmy, SDWORD
|
|||
#define NOTE_SLIDE
|
||||
#define NOTE_STATE(x)
|
||||
#endif
|
||||
// FRACT mag, rad, temp;
|
||||
FRACT radx,rady;
|
||||
// float mag, rad, temp;
|
||||
float radx,rady;
|
||||
BOOL blocked;
|
||||
SDWORD slideDir;
|
||||
|
||||
|
@ -1372,7 +1372,7 @@ static void moveCalcBlockingSlide(DROID *psDroid, FRACT *pmx, FRACT *pmy, SDWORD
|
|||
/* if (!blocked)
|
||||
{
|
||||
rad = MKF(moveObjRadius((BASE_OBJECT *)psDroid));
|
||||
mag = fSQRT(mx*mx + my*my);
|
||||
mag = sqrtf(mx*mx + my*my);
|
||||
|
||||
if (mag==0)
|
||||
{
|
||||
|
@ -1731,7 +1731,7 @@ static void moveCalcBlockingSlide(DROID *psDroid, FRACT *pmx, FRACT *pmy, SDWORD
|
|||
|
||||
// see if a droid has run into another droid
|
||||
// Only consider stationery droids
|
||||
static void moveCalcDroidSlide(DROID *psDroid, FRACT *pmx, FRACT *pmy)
|
||||
static void moveCalcDroidSlide(DROID *psDroid, float *pmx, float *pmy)
|
||||
{
|
||||
SDWORD i, droidR, rad, radSq;
|
||||
SDWORD objR;
|
||||
|
@ -1800,8 +1800,8 @@ static void moveCalcDroidSlide(DROID *psDroid, FRACT *pmx, FRACT *pmy)
|
|||
if (psObst != NULL || !aiCheckAlliances(psInfo->psObj->player, psDroid->player))
|
||||
{
|
||||
// hit more than one droid - stop
|
||||
*pmx = (FRACT)0;
|
||||
*pmy = (FRACT)0;
|
||||
*pmx = (float)0;
|
||||
*pmy = (float)0;
|
||||
psObst = NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -1867,14 +1867,14 @@ static void moveCalcDroidSlide(DROID *psDroid, FRACT *pmx, FRACT *pmy)
|
|||
#define REDARROW 179
|
||||
|
||||
// get an obstacle avoidance vector
|
||||
static void moveGetObstVector4(DROID *psDroid, FRACT *pX, FRACT *pY)
|
||||
static void moveGetObstVector4(DROID *psDroid, float *pX, float *pY)
|
||||
{
|
||||
SDWORD i,xdiff,ydiff, absx,absy, dist;
|
||||
BASE_OBJECT *psObj;
|
||||
SDWORD numObst, distTot;
|
||||
FRACT dirX,dirY;
|
||||
FRACT omag, ox,oy, ratio;
|
||||
FRACT avoidX,avoidY;
|
||||
float dirX,dirY;
|
||||
float omag, ox,oy, ratio;
|
||||
float avoidX,avoidY;
|
||||
SDWORD mapX,mapY, tx,ty, td;
|
||||
PROPULSION_STATS *psPropStats;
|
||||
|
||||
|
@ -1993,7 +1993,7 @@ static void moveGetObstVector4(DROID *psDroid, FRACT *pX, FRACT *pY)
|
|||
}
|
||||
else
|
||||
{
|
||||
omag = fSQRT(dirX*dirX + dirY*dirY);
|
||||
omag = sqrtf(dirX*dirX + dirY*dirY);
|
||||
ox = dirX / omag;
|
||||
oy = dirY / omag;
|
||||
if (FRACTmul((*pX), oy) + FRACTmul((*pY),-ox) < 0)
|
||||
|
@ -2057,15 +2057,15 @@ static void moveGetObstVector4(DROID *psDroid, FRACT *pX, FRACT *pY)
|
|||
|
||||
/* Get a direction for a droid to avoid obstacles etc. */
|
||||
// This routine smells ...
|
||||
static void moveGetDirection(DROID *psDroid, FRACT *pX, FRACT *pY)
|
||||
static void moveGetDirection(DROID *psDroid, float *pX, float *pY)
|
||||
{
|
||||
SDWORD dx,dy, tx,ty;
|
||||
SDWORD mag;
|
||||
FRACT root;
|
||||
float root;
|
||||
BOOL bNoVector;
|
||||
|
||||
SDWORD ndx,ndy, ntx,nty, nmag;
|
||||
FRACT nroot;
|
||||
float nroot;
|
||||
|
||||
|
||||
tx = psDroid->sMove.targetX;
|
||||
|
@ -2092,8 +2092,8 @@ static void moveGetDirection(DROID *psDroid, FRACT *pX, FRACT *pY)
|
|||
if (mag != 0 && nmag != 0)
|
||||
{
|
||||
// Get the size of the vectors
|
||||
root = fSQRT(MAKEFRACT(mag));
|
||||
nroot = fSQRT(MAKEFRACT(nmag));
|
||||
root = sqrtf(MAKEFRACT(mag));
|
||||
nroot = sqrtf(MAKEFRACT(nmag));
|
||||
|
||||
// Split the proportion of the vectors based on how close to the point they are
|
||||
ndx = (ndx * (WAYPOINT_DSQ - mag)) / WAYPOINT_DSQ;
|
||||
|
@ -2113,7 +2113,7 @@ static void moveGetDirection(DROID *psDroid, FRACT *pX, FRACT *pY)
|
|||
|
||||
{
|
||||
|
||||
root = fSQRT(MAKEFRACT(mag));
|
||||
root = sqrtf(MAKEFRACT(mag));
|
||||
*pX = FRACTdiv(MKF(dx), root);
|
||||
*pY = FRACTdiv(MKF(dy), root);
|
||||
|
||||
|
@ -2375,10 +2375,10 @@ static BOOL moveDroidStopped( DROID *psDroid, SDWORD speed )
|
|||
|
||||
static void moveUpdateDroidDirection( DROID *psDroid, SDWORD *pSpeed, SDWORD direction,
|
||||
SDWORD iSpinAngle, SDWORD iSpinSpeed, SDWORD iTurnSpeed, float *pDroidDir,
|
||||
FRACT *pfSpeed ) // direction is target-direction
|
||||
float *pfSpeed ) // direction is target-direction
|
||||
{
|
||||
float adiff;
|
||||
FRACT temp;
|
||||
float temp;
|
||||
|
||||
*pfSpeed = MKF(*pSpeed);
|
||||
*pDroidDir = psDroid->direction;
|
||||
|
@ -2414,10 +2414,10 @@ static void moveUpdateDroidDirection( DROID *psDroid, SDWORD *pSpeed, SDWORD dir
|
|||
|
||||
|
||||
// Calculate current speed perpendicular to droids direction
|
||||
static FRACT moveCalcPerpSpeed( DROID *psDroid, float iDroidDir, SDWORD iSkidDecel )
|
||||
static float moveCalcPerpSpeed( DROID *psDroid, float iDroidDir, SDWORD iSkidDecel )
|
||||
{
|
||||
float adiff;
|
||||
FRACT perpSpeed;
|
||||
float perpSpeed;
|
||||
|
||||
adiff = fabsf(iDroidDir - psDroid->sMove.moveDir);
|
||||
perpSpeed = psDroid->sMove.speed * trigSin(adiff);
|
||||
|
@ -2433,11 +2433,11 @@ static FRACT moveCalcPerpSpeed( DROID *psDroid, float iDroidDir, SDWORD iSkidDec
|
|||
}
|
||||
|
||||
|
||||
static void moveCombineNormalAndPerpSpeeds( DROID *psDroid, FRACT fNormalSpeed,
|
||||
FRACT fPerpSpeed, float iDroidDir )
|
||||
static void moveCombineNormalAndPerpSpeeds( DROID *psDroid, float fNormalSpeed,
|
||||
float fPerpSpeed, float iDroidDir )
|
||||
{
|
||||
float finalDir, adiff;
|
||||
FRACT finalSpeed;
|
||||
float finalSpeed;
|
||||
|
||||
/* set current direction */
|
||||
psDroid->direction = iDroidDir;
|
||||
|
@ -2450,7 +2450,7 @@ static void moveCombineNormalAndPerpSpeeds( DROID *psDroid, FRACT fNormalSpeed,
|
|||
return;
|
||||
}
|
||||
|
||||
finalSpeed = fSQRT(Fmul(fNormalSpeed,fNormalSpeed) + Fmul(fPerpSpeed,fPerpSpeed));
|
||||
finalSpeed = sqrtf(Fmul(fNormalSpeed,fNormalSpeed) + Fmul(fPerpSpeed,fPerpSpeed));
|
||||
|
||||
// calculate the angle between the droid facing and movement direction
|
||||
finalDir = trigInvCos(fNormalSpeed / finalSpeed);
|
||||
|
@ -2494,11 +2494,11 @@ static void moveCombineNormalAndPerpSpeeds( DROID *psDroid, FRACT fNormalSpeed,
|
|||
|
||||
|
||||
// Calculate the current speed in the droids normal direction
|
||||
static FRACT moveCalcNormalSpeed( DROID *psDroid, FRACT fSpeed, float iDroidDir,
|
||||
static float moveCalcNormalSpeed( DROID *psDroid, float fSpeed, float iDroidDir,
|
||||
SDWORD iAccel, SDWORD iDecel )
|
||||
{
|
||||
float adiff;
|
||||
FRACT normalSpeed;
|
||||
float normalSpeed;
|
||||
|
||||
adiff = fabsf(iDroidDir - psDroid->sMove.moveDir);
|
||||
normalSpeed = psDroid->sMove.speed * trigCos(adiff);
|
||||
|
@ -2526,9 +2526,9 @@ static FRACT moveCalcNormalSpeed( DROID *psDroid, FRACT fSpeed, float iDroidDir,
|
|||
}
|
||||
|
||||
|
||||
static void moveGetDroidPosDiffs( DROID *psDroid, FRACT *pDX, FRACT *pDY )
|
||||
static void moveGetDroidPosDiffs( DROID *psDroid, float *pDX, float *pDY )
|
||||
{
|
||||
FRACT move;
|
||||
float move;
|
||||
|
||||
|
||||
move = Fmul(psDroid->sMove.speed, baseSpeed);
|
||||
|
@ -2572,7 +2572,7 @@ static void moveCheckFinalWaypoint( DROID *psDroid, SDWORD *pSpeed )
|
|||
}
|
||||
}
|
||||
|
||||
static void moveUpdateDroidPos( DROID *psDroid, FRACT dx, FRACT dy )
|
||||
static void moveUpdateDroidPos( DROID *psDroid, float dx, float dy )
|
||||
{
|
||||
SDWORD iX = 0, iY = 0;
|
||||
|
||||
|
@ -2640,7 +2640,7 @@ static void moveUpdateDroidPos( DROID *psDroid, FRACT dx, FRACT dy )
|
|||
/* Update a tracked droids position and speed given target values */
|
||||
static void moveUpdateGroundModel(DROID *psDroid, SDWORD speed, SDWORD direction)
|
||||
{
|
||||
FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed, bx,by;
|
||||
float fPerpSpeed, fNormalSpeed, dx, dy, fSpeed, bx,by;
|
||||
float iDroidDir;
|
||||
SDWORD slideDir;
|
||||
PROPULSION_STATS *psPropStats;
|
||||
|
@ -2649,9 +2649,9 @@ static void moveUpdateGroundModel(DROID *psDroid, SDWORD speed, SDWORD direction
|
|||
static SDWORD hvrSkid = HOVER_SKID_DECEL;
|
||||
static SDWORD whlSkid = WHEELED_SKID_DECEL;
|
||||
static SDWORD trkSkid = TRACKED_SKID_DECEL;
|
||||
static FRACT hvrTurn = FRACTCONST(3,4); //0.75f;
|
||||
static FRACT whlTurn = FRACTCONST(1,1); //1.0f;
|
||||
static FRACT trkTurn = FRACTCONST(1,1); //1.0f;
|
||||
static float hvrTurn = FRACTCONST(3,4); //0.75f;
|
||||
static float whlTurn = FRACTCONST(1,1); //1.0f;
|
||||
static float trkTurn = FRACTCONST(1,1); //1.0f;
|
||||
|
||||
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
|
||||
switch (psPropStats->propulsionType)
|
||||
|
@ -2744,7 +2744,7 @@ if(psDroid == driveGetDriven()) debug( LOG_NEVER, "%d\n", speed );
|
|||
/* Update a persons position and speed given target values */
|
||||
void moveUpdatePersonModel(DROID *psDroid, SDWORD speed, SDWORD direction)
|
||||
{
|
||||
FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed;
|
||||
float fPerpSpeed, fNormalSpeed, dx, dy, fSpeed;
|
||||
float iDroidDir;
|
||||
SDWORD slideDir;
|
||||
// BASE_OBJECT *psObst;
|
||||
|
@ -2913,10 +2913,10 @@ void moveMakeVtolHover( DROID *psDroid )
|
|||
|
||||
static void moveUpdateVtolModel(DROID *psDroid, SDWORD speed, SDWORD direction)
|
||||
{
|
||||
FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed;
|
||||
float fPerpSpeed, fNormalSpeed, dx, dy, fSpeed;
|
||||
float iDroidDir;
|
||||
SDWORD iMapZ, iRoll, slideDir, iSpinSpeed, iTurnSpeed;
|
||||
FRACT fDZ, fDroidZ, fMapZ;
|
||||
float fDZ, fDroidZ, fMapZ;
|
||||
|
||||
|
||||
// nothing to do if the droid is stopped
|
||||
|
@ -2974,9 +2974,9 @@ static void moveUpdateVtolModel(DROID *psDroid, SDWORD speed, SDWORD direction)
|
|||
|
||||
/* do vertical movement */
|
||||
|
||||
fDZ = (FRACT)(psDroid->sMove.iVertSpeed * (SDWORD)frameTime) / GAME_TICKS_PER_SEC;
|
||||
fDZ = (float)(psDroid->sMove.iVertSpeed * (SDWORD)frameTime) / GAME_TICKS_PER_SEC;
|
||||
fDroidZ = psDroid->sMove.fz;
|
||||
fMapZ = (FRACT) map_Height(psDroid->x, psDroid->y);
|
||||
fMapZ = (float) map_Height(psDroid->x, psDroid->y);
|
||||
if ( fDroidZ+fDZ < 0 )
|
||||
{
|
||||
psDroid->sMove.fz = 0;
|
||||
|
@ -3073,7 +3073,7 @@ moveCyborgTouchDownAnimDone( ANIM_OBJECT *psObj )
|
|||
|
||||
static void moveUpdateJumpCyborgModel(DROID *psDroid, SDWORD speed, SDWORD direction)
|
||||
{
|
||||
FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed;
|
||||
float fPerpSpeed, fNormalSpeed, dx, dy, fSpeed;
|
||||
float iDroidDir;
|
||||
|
||||
// nothing to do if the droid is stopped
|
||||
|
@ -3498,13 +3498,13 @@ void moveUpdateDroid(DROID *psDroid)
|
|||
{
|
||||
// SDWORD xdiff,ydiff, obstX,obstY;
|
||||
// UDWORD mapX,mapY, tarSpeed;
|
||||
// FRACT newX,newY;
|
||||
// FRACT speed;
|
||||
// FRACT dangle;
|
||||
// float newX,newY;
|
||||
// float speed;
|
||||
// float dangle;
|
||||
// BASE_OBJECT *psObst;
|
||||
|
||||
FRACT tx,ty; //adiff, dx,dy, mx,my;
|
||||
FRACT tangle; // thats DROID angle and TARGET angle - not some bizzare pun :-)
|
||||
float tx,ty; //adiff, dx,dy, mx,my;
|
||||
float tangle; // thats DROID angle and TARGET angle - not some bizzare pun :-)
|
||||
// doesn't matter - they're still shit names...! :-)
|
||||
SDWORD fx, fy;
|
||||
UDWORD oldx, oldy, iZ;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "findpath.h"
|
||||
|
||||
/* The base movement speed */
|
||||
extern FRACT baseSpeed;
|
||||
extern float baseSpeed;
|
||||
|
||||
// The next object that should get the router when a lot of units are
|
||||
// in a MOVEROUTE state
|
||||
|
|
|
@ -66,10 +66,10 @@ typedef struct _move_control
|
|||
SDWORD srcX,srcY,targetX,targetY;
|
||||
|
||||
/* Stuff for John's movement update */
|
||||
FRACT fx,fy; // droid location as a fract
|
||||
// FRACT dx,dy; // x and y change for current direction
|
||||
float fx,fy; // droid location as a fract
|
||||
// float dx,dy; // x and y change for current direction
|
||||
// NOTE: this is supposed to replace Speed
|
||||
FRACT speed; // Speed of motion
|
||||
float speed; // Speed of motion
|
||||
SWORD boundX,boundY; // Vector for the end of path boundary
|
||||
|
||||
float moveDir; // direction of motion (not the direction the droid is facing)
|
||||
|
@ -92,7 +92,7 @@ typedef struct _move_control
|
|||
|
||||
// added for vtol movement
|
||||
|
||||
FRACT fz;
|
||||
float fz;
|
||||
|
||||
|
||||
/* Only needed for Alex's movement update ? */
|
||||
|
|
|
@ -151,8 +151,8 @@ BOOL multiplayerWinSequence(BOOL firstCall)
|
|||
static Vector3i pos;
|
||||
Vector3i pos2;
|
||||
static UDWORD last=0;
|
||||
FRACT fraction;
|
||||
FRACT rotAmount;
|
||||
float fraction;
|
||||
float rotAmount;
|
||||
STRUCTURE *psStruct;
|
||||
|
||||
if(firstCall)
|
||||
|
|
|
@ -72,13 +72,13 @@ static void highLevelDroidUpdate(DROID *psDroid,
|
|||
|
||||
static void onscreenUpdate (DROID *pDroid,UDWORD dam, // the droid and its damage
|
||||
UDWORD x, UDWORD y, // the ideal position
|
||||
FRACT fx,FRACT fy, // the ideal fractional position
|
||||
float fx,float fy, // the ideal fractional position
|
||||
UWORD dir, // direction it should facing
|
||||
DROID_ORDER order); // what it should be doing
|
||||
|
||||
static void offscreenUpdate (DROID *pDroid,UDWORD dam,
|
||||
UDWORD x, UDWORD y,
|
||||
FRACT fx,FRACT fy,
|
||||
float fx,float fy,
|
||||
UWORD dir,
|
||||
DROID_ORDER order);
|
||||
|
||||
|
@ -317,7 +317,7 @@ static void packageCheck(UDWORD i, NETMSG *pMsg, DROID *pD)
|
|||
// receive a check and update the local world state accordingly
|
||||
BOOL recvDroidCheck(NETMSG *m)
|
||||
{
|
||||
FRACT fx=0,fy=0;
|
||||
float fx=0,fy=0;
|
||||
UDWORD ref,player,x = 0,y = 0,bod,target=0;//,dir;
|
||||
UWORD dir,numkills;
|
||||
DROID_ORDER ord;
|
||||
|
@ -493,8 +493,8 @@ static void onscreenUpdate(DROID *psDroid,
|
|||
UDWORD dam,
|
||||
UDWORD x,
|
||||
UDWORD y,
|
||||
FRACT fx,
|
||||
FRACT fy,
|
||||
float fx,
|
||||
float fy,
|
||||
UWORD dir,
|
||||
DROID_ORDER order)
|
||||
{
|
||||
|
@ -530,8 +530,8 @@ static void offscreenUpdate(DROID *psDroid,
|
|||
UDWORD dam,
|
||||
UDWORD x,
|
||||
UDWORD y,
|
||||
FRACT fx,
|
||||
FRACT fy,
|
||||
float fx,
|
||||
float fy,
|
||||
UWORD dir,
|
||||
DROID_ORDER order)
|
||||
{
|
||||
|
|
|
@ -211,8 +211,8 @@ void optimisePathForDroid(DROID *psDroid)
|
|||
*/
|
||||
UDWORD getBisectingDirectionAway(UDWORD angleA,UDWORD angleB)
|
||||
{
|
||||
FRACT xVec,yVec;
|
||||
FRACT angle;
|
||||
float xVec,yVec;
|
||||
float angle;
|
||||
UDWORD retVal;
|
||||
|
||||
/* Get the component vectors */
|
||||
|
@ -239,7 +239,7 @@ UDWORD retVal;
|
|||
*/
|
||||
UDWORD getStepIndexFromAngle(UDWORD angle)
|
||||
{
|
||||
FRACT accA;
|
||||
float accA;
|
||||
UDWORD retVal = 0;
|
||||
|
||||
accA = MAKEFRACT(angle);
|
||||
|
|
16
src/order.c
16
src/order.c
|
@ -25,12 +25,6 @@
|
|||
*/
|
||||
#include <string.h>
|
||||
|
||||
// moral check printf's
|
||||
//#define DEBUG_GROUP0
|
||||
// secondary order factory printf's
|
||||
//#define DEBUG_GROUP1
|
||||
// order recieved printf's
|
||||
//#define DEBUG_GROUP2
|
||||
#include "lib/framework/frame.h"
|
||||
#include "lib/framework/input.h"
|
||||
|
||||
|
@ -1437,7 +1431,7 @@ static void orderCmdGroupBase(DROID_GROUP *psGroup, DROID_ORDER_DATA *psData)
|
|||
WZ_DECL_UNUSED static void orderCheckFireSupportPos(DROID *psSensor, DROID_ORDER_DATA *psOrder)
|
||||
{
|
||||
SDWORD fsx,fsy, fsnum, sensorVX,sensorVY, fsVX,fsVY;
|
||||
FRACT sensorAngle, fsAngle, adiff;
|
||||
float sensorAngle, fsAngle, adiff;
|
||||
SDWORD xdiff,ydiff;
|
||||
SECONDARY_STATE state;
|
||||
DROID *psCurr;
|
||||
|
@ -1487,16 +1481,16 @@ WZ_DECL_UNUSED static void orderCheckFireSupportPos(DROID *psSensor, DROID_ORDER
|
|||
}
|
||||
|
||||
// now get the angle between the firesupport units and the sensor move
|
||||
sensorAngle = (FRACT)atan2(sensorVY, sensorVX);
|
||||
fsAngle = (FRACT)atan2(fsVY, fsVX);
|
||||
sensorAngle = (float)atan2f(sensorVY, sensorVX);
|
||||
fsAngle = (float)atan2f(fsVY, fsVX);
|
||||
adiff = fsAngle - sensorAngle;
|
||||
if (adiff < 0)
|
||||
{
|
||||
adiff += (FRACT)(M_PI * 2);
|
||||
adiff += (float)(M_PI * 2);
|
||||
}
|
||||
if (adiff > M_PI)
|
||||
{
|
||||
adiff -= (FRACT)(M_PI);
|
||||
adiff -= (float)(M_PI);
|
||||
}
|
||||
|
||||
// if the angle between the firesupport units and the sensor move is bigger
|
||||
|
|
|
@ -651,7 +651,7 @@ proj_InFlightDirectFunc( PROJ_OBJECT *psObj )
|
|||
}
|
||||
|
||||
// ffs
|
||||
rad = (SDWORD)iSQRT( dx*dx + dy*dy );
|
||||
rad = (SDWORD)sqrtf( dx*dx + dy*dy );
|
||||
//Watermelon:extended life span
|
||||
extendRad = (SDWORD)(rad * 1.5f);
|
||||
|
||||
|
@ -907,7 +907,7 @@ proj_InFlightIndirectFunc( PROJ_OBJECT *psObj )
|
|||
WEAPON_STATS *psStats;
|
||||
SDWORD iTime, iRad, iDist, dx, dy, dz, iX, iY;
|
||||
Vector3i pos;
|
||||
FRACT fVVert;
|
||||
float fVVert;
|
||||
BOOL bOver = FALSE;
|
||||
//Watermelon:psTempObj,psNewTarget,i,xdiff,ydiff,zdiff
|
||||
BASE_OBJECT *psTempObj;
|
||||
|
@ -933,7 +933,7 @@ proj_InFlightIndirectFunc( PROJ_OBJECT *psObj )
|
|||
dy = (SDWORD)psObj->tarY-(SDWORD)psObj->startY;
|
||||
|
||||
// ffs
|
||||
iRad = (SDWORD)iSQRT( dx*dx + dy*dy );
|
||||
iRad = (SDWORD)sqrtf( dx*dx + dy*dy );
|
||||
|
||||
iDist = iTime * psObj->vXY / GAME_TICKS_PER_SEC;
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ typedef struct _ray_point
|
|||
/* x and y increments for each ray angle */
|
||||
static SDWORD rayDX[NUM_RAYS], rayDY[NUM_RAYS];
|
||||
static SDWORD rayHDist[NUM_RAYS], rayVDist[NUM_RAYS];
|
||||
//static FRACT rayTan[NUM_RAYS], rayCos[NUM_RAYS], raySin[NUM_RAYS];
|
||||
//static float rayTan[NUM_RAYS], rayCos[NUM_RAYS], raySin[NUM_RAYS];
|
||||
static SDWORD rayFPTan[NUM_RAYS], rayFPInvTan[NUM_RAYS];
|
||||
static SDWORD rayFPInvCos[NUM_RAYS], rayFPInvSin[NUM_RAYS];
|
||||
|
||||
|
@ -70,8 +70,8 @@ static SDWORD rayFPInvCos[NUM_RAYS], rayFPInvSin[NUM_RAYS];
|
|||
BOOL rayInitialise(void)
|
||||
{
|
||||
SDWORD i;
|
||||
FRACT angle = MAKEFRACT(0);
|
||||
FRACT val;
|
||||
float angle = MAKEFRACT(0);
|
||||
float val;
|
||||
|
||||
for(i=0; i<NUM_RAYS; i++)
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ BOOL rayInitialise(void)
|
|||
}
|
||||
|
||||
if(val == 0) {
|
||||
val = (FRACT)1; // Horrible hack to avoid divide by zero.
|
||||
val = (float)1; // Horrible hack to avoid divide by zero.
|
||||
}
|
||||
|
||||
rayDY[i] = (SDWORD)(TILE_UNITS * RAY_ACCMUL / val);
|
||||
|
@ -103,7 +103,7 @@ BOOL rayInitialise(void)
|
|||
// Set up the trig tables for calculating the offset distances
|
||||
val = (float)sin(angle);
|
||||
if(val == 0) {
|
||||
val = (FRACT)1;
|
||||
val = (float)1;
|
||||
}
|
||||
rayFPInvSin[i] = MAKEINT(FRACTdiv(MAKEFRACT(RAY_ACCMUL), val));
|
||||
if (i >= NUM_RAYS/2)
|
||||
|
@ -117,7 +117,7 @@ BOOL rayInitialise(void)
|
|||
|
||||
val = (float)cos(angle);
|
||||
if(val == 0) {
|
||||
val = (FRACT)1;
|
||||
val = (float)1;
|
||||
}
|
||||
rayFPInvCos[i] = MAKEINT(FRACTdiv(MAKEFRACT(RAY_ACCMUL), val));
|
||||
if (i < NUM_RAYS/4 || i > 3*NUM_RAYS/4)
|
||||
|
@ -458,13 +458,13 @@ SDWORD rayPointDist(SDWORD x1,SDWORD y1, SDWORD x2,SDWORD y2,
|
|||
/* Nasty global vars - put into a structure? */
|
||||
//-----------------------------------------------------------------------------------
|
||||
SDWORD gHeight;
|
||||
FRACT gPitch;
|
||||
float gPitch;
|
||||
UDWORD gStartTileX;
|
||||
UDWORD gStartTileY;
|
||||
|
||||
SDWORD gHighestHeight,gHOrigHeight;
|
||||
SDWORD gHMinDist;
|
||||
FRACT gHPitch;
|
||||
float gHPitch;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
@ -502,7 +502,7 @@ static BOOL getTileHighestCallback(SDWORD x, SDWORD y, SDWORD dist)
|
|||
static BOOL getTileHeightCallback(SDWORD x, SDWORD y, SDWORD dist)
|
||||
{
|
||||
SDWORD height,heightDif;
|
||||
FRACT newPitch;
|
||||
float newPitch;
|
||||
BOOL HasTallStructure = FALSE;
|
||||
#ifdef TEST_RAY
|
||||
Vector3i pos;
|
||||
|
|
|
@ -253,8 +253,8 @@ UDWORD index;
|
|||
BOOL bMoreBars;
|
||||
UDWORD x,y;
|
||||
UDWORD width,height;
|
||||
FRACT length;
|
||||
FRACT mul;
|
||||
float length;
|
||||
float mul;
|
||||
UDWORD div;
|
||||
|
||||
if(!bDispStarted)
|
||||
|
@ -375,7 +375,7 @@ void fillUpStats( void )
|
|||
{
|
||||
UDWORD i;
|
||||
UDWORD maxi,num;
|
||||
FRACT scaleFactor;
|
||||
float scaleFactor;
|
||||
UDWORD length;
|
||||
UDWORD numUnits;
|
||||
DROID *psDroid;
|
||||
|
|
|
@ -5375,7 +5375,7 @@ STRUCTURE *psStructure;
|
|||
FEATURE *psFeature;
|
||||
BASE_OBJECT *psObj;
|
||||
UDWORD damagePercent;
|
||||
FRACT divisor;
|
||||
float divisor;
|
||||
UDWORD newVal;
|
||||
|
||||
/* OK - let's get the vars */
|
||||
|
|
|
@ -2163,7 +2163,7 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y,
|
|||
psBuilding->roll = 0;
|
||||
//psBuilding->damage = structureDamage;
|
||||
psBuilding->selected = FALSE;
|
||||
//psBuilding->heightScale = (FRACT)0;
|
||||
//psBuilding->heightScale = (float)0;
|
||||
psBuilding->status = SS_BEING_BUILT;
|
||||
psBuilding->currentBuildPts = 0;
|
||||
psBuilding->currentPowerAccrued = 0;
|
||||
|
@ -9081,10 +9081,10 @@ void checkResExtractorsActive(void)
|
|||
}
|
||||
|
||||
/*Used for determining how much of the structure to draw as being built or demolished*/
|
||||
FRACT structHeightScale(STRUCTURE *psStruct)
|
||||
float structHeightScale(STRUCTURE *psStruct)
|
||||
{
|
||||
|
||||
FRACT retVal;
|
||||
float retVal;
|
||||
retVal = (MAKEFRACT(psStruct->currentBuildPts)/psStruct->pStructureType->buildPoints);
|
||||
if(retVal<0.05f)
|
||||
{
|
||||
|
@ -9581,7 +9581,7 @@ void structUpdateRecoil( STRUCTURE *psStruct )
|
|||
{
|
||||
UDWORD percent;
|
||||
UDWORD recoil;
|
||||
FRACT fraction;
|
||||
float fraction;
|
||||
|
||||
/* Check it's actually got a weapon */
|
||||
if(psStruct->asWeaps[0].nStat == 0)
|
||||
|
|
|
@ -327,7 +327,7 @@ extern void checkResExtractorsActive(void);
|
|||
extern UWORD countAssignableFactories(UBYTE player,UWORD FactoryType);
|
||||
|
||||
/*Used for determining how much of the structure to draw as being built or demolished*/
|
||||
extern FRACT structHeightScale(STRUCTURE *psStruct);
|
||||
extern float structHeightScale(STRUCTURE *psStruct);
|
||||
|
||||
/*compares the structure sensor type with the droid weapon type to see if the
|
||||
FIRE_SUPPORT order can be assigned*/
|
||||
|
|
|
@ -73,7 +73,7 @@ static SDWORD currObj;
|
|||
#define VIS_LEVEL_INC (255*2)
|
||||
#define VIS_LEVEL_DEC 50
|
||||
// fractional accumulator of how much to change visibility this frame
|
||||
static FRACT visLevelIncAcc, visLevelDecAcc;
|
||||
static float visLevelIncAcc, visLevelDecAcc;
|
||||
// integer amount to change visiblility this turn
|
||||
static SDWORD visLevelInc, visLevelDec;
|
||||
|
||||
|
|
66
src/warcam.c
66
src/warcam.c
|
@ -98,7 +98,7 @@ SDWORD presAvAngle = 0;;
|
|||
/* These used to be #defines but they're variable now as it may be necessary
|
||||
to allow the player to customise tracking speed? Jim?
|
||||
*/
|
||||
FRACT accelConstant,velocityConstant, rotAccelConstant, rotVelocityConstant;
|
||||
float accelConstant,velocityConstant, rotAccelConstant, rotVelocityConstant;
|
||||
|
||||
/* How much info do you want when tracking a droid - this toggles full stat info */
|
||||
static BOOL bFullInfo = FALSE;
|
||||
|
@ -108,14 +108,14 @@ static BOOL bRadarTrackingRequested = FALSE;
|
|||
|
||||
/* World coordinates for a radar track/jump */
|
||||
//static SDWORD radarX,radarY;
|
||||
static FRACT radarX,radarY;
|
||||
static float radarX,radarY;
|
||||
|
||||
/* Where we were up to (pos and rot) last update - allows us to see whether
|
||||
we are sufficently near our target to disable further tracking */
|
||||
static Vector3i oldPosition, oldRotation;
|
||||
|
||||
/* The fraction of a second that the last game frame took */
|
||||
static FRACT fraction;
|
||||
static float fraction;
|
||||
|
||||
static BOOL OldViewValid;
|
||||
|
||||
|
@ -588,9 +588,9 @@ void camAllignWithTarget(BASE_OBJECT *psTarget)
|
|||
static SDWORD getAverageTrackAngle( BOOL bCheckOnScreen )
|
||||
{
|
||||
DROID *psDroid;
|
||||
FRACT xShift, yShift;
|
||||
FRACT xTotal = 0.0, yTotal = 0.0;
|
||||
FRACT averageAngleFloat = 0;
|
||||
float xShift, yShift;
|
||||
float xTotal = 0.0, yTotal = 0.0;
|
||||
float averageAngleFloat = 0;
|
||||
SDWORD droidCount = 0, averageAngle = 0;
|
||||
SDWORD retVal;
|
||||
|
||||
|
@ -630,9 +630,9 @@ static SDWORD getAverageTrackAngle( BOOL bCheckOnScreen )
|
|||
static SDWORD getGroupAverageTrackAngle(UDWORD groupNumber, BOOL bCheckOnScreen)
|
||||
{
|
||||
DROID *psDroid;
|
||||
FRACT xShift, yShift;
|
||||
FRACT xTotal = 0.0, yTotal = 0.0;
|
||||
FRACT averageAngleFloat = 0;
|
||||
float xShift, yShift;
|
||||
float xTotal = 0.0, yTotal = 0.0;
|
||||
float averageAngleFloat = 0;
|
||||
SDWORD droidCount = 0, averageAngle = 0;
|
||||
SDWORD retVal;
|
||||
|
||||
|
@ -769,7 +769,7 @@ in the case of location and degrees of arc in the case of rotation.
|
|||
|
||||
static void updateCameraAcceleration(UBYTE update)
|
||||
{
|
||||
FRACT separation;
|
||||
float separation;
|
||||
SDWORD realPos;
|
||||
SDWORD xConcern,yConcern,zConcern;
|
||||
SDWORD xBehind,yBehind;
|
||||
|
@ -869,16 +869,16 @@ SDWORD angle;
|
|||
{
|
||||
/* Need to update acceleration along x axis */
|
||||
realPos = xConcern - (CAM_X_SHIFT) - xBehind;
|
||||
separation = (FRACT)(realPos - trackingCamera.position.x);
|
||||
separation = (float)(realPos - trackingCamera.position.x);
|
||||
if(!bFlying)
|
||||
{
|
||||
trackingCamera.acceleration.x =
|
||||
(accelConstant*separation - velocityConstant*(FRACT)trackingCamera.velocity.x);
|
||||
(accelConstant*separation - velocityConstant*(float)trackingCamera.velocity.x);
|
||||
}
|
||||
else
|
||||
{
|
||||
trackingCamera.acceleration.x =
|
||||
((accelConstant*separation*4) - (velocityConstant*2*(FRACT)trackingCamera.velocity.x));
|
||||
((accelConstant*separation*4) - (velocityConstant*2*(float)trackingCamera.velocity.x));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -890,7 +890,7 @@ SDWORD angle;
|
|||
|
||||
/* Need to update acceleration along y axis */
|
||||
realPos = (yConcern);
|
||||
separation = (FRACT)(realPos - trackingCamera.position.y);
|
||||
separation = (float)(realPos - trackingCamera.position.y);
|
||||
if(bFlying) separation = separation/2;
|
||||
// CONPRINTF(ConsoleString,(ConsoleString,"Separation : %f",separation));
|
||||
// CONPRINTF(ConsoleString,(ConsoleString,"Distance : %d",distance));
|
||||
|
@ -910,7 +910,7 @@ SDWORD angle;
|
|||
{
|
||||
/* Need to update acceleration along z axis */
|
||||
realPos = zConcern - (CAM_Z_SHIFT) - yBehind;
|
||||
separation = (FRACT)(realPos - trackingCamera.position.z);
|
||||
separation = (float)(realPos - trackingCamera.position.z);
|
||||
if(!bFlying)
|
||||
{
|
||||
trackingCamera.acceleration.z =
|
||||
|
@ -930,7 +930,7 @@ SDWORD angle;
|
|||
static void updateCameraVelocity( UBYTE update )
|
||||
{
|
||||
//UDWORD frameTime;
|
||||
FRACT fraction;
|
||||
float fraction;
|
||||
|
||||
/* Get the time fraction of a second - the next two lines are present in 4
|
||||
of the next six functions. All 4 of these functions are called every frame, so
|
||||
|
@ -938,7 +938,7 @@ FRACT fraction;
|
|||
I've left them in for clarity for now */
|
||||
|
||||
// frameTime = gameTime - trackingCamera.lastUpdate;
|
||||
fraction = (MAKEFRACT(frameTime2) / (FRACT)GAME_TICKS_PER_SEC);
|
||||
fraction = (MAKEFRACT(frameTime2) / (float)GAME_TICKS_PER_SEC);
|
||||
|
||||
if(update & X_UPDATE)
|
||||
{
|
||||
|
@ -962,7 +962,7 @@ static void updateCameraPosition(UBYTE update)
|
|||
{
|
||||
//UDWORD frameTime;
|
||||
BOOL bFlying;
|
||||
FRACT fraction;
|
||||
float fraction;
|
||||
DROID *psDroid;
|
||||
PROPULSION_STATS *psPropStats;
|
||||
|
||||
|
@ -978,7 +978,7 @@ PROPULSION_STATS *psPropStats;
|
|||
}
|
||||
/* See above */
|
||||
// frameTime = gameTime - trackingCamera.lastUpdate;
|
||||
fraction = (MAKEFRACT(frameTime2) / (FRACT)GAME_TICKS_PER_SEC);
|
||||
fraction = (MAKEFRACT(frameTime2) / (float)GAME_TICKS_PER_SEC);
|
||||
|
||||
if(update & X_UPDATE)
|
||||
{
|
||||
|
@ -997,7 +997,7 @@ PROPULSION_STATS *psPropStats;
|
|||
// }
|
||||
// else
|
||||
// {
|
||||
// trackingCamera.position.y += MAKEINT(((FRACT)trackingCamera.velocity.y * fraction));
|
||||
// trackingCamera.position.y += MAKEINT(((float)trackingCamera.velocity.y * fraction));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -1014,7 +1014,7 @@ PROPULSION_STATS *psPropStats;
|
|||
static void updateCameraRotationAcceleration( UBYTE update )
|
||||
{
|
||||
SDWORD worldAngle;
|
||||
FRACT separation;
|
||||
float separation;
|
||||
SDWORD xConcern, yConcern, zConcern;
|
||||
BOOL bTooLow;
|
||||
DROID *psDroid;
|
||||
|
@ -1070,7 +1070,7 @@ SDWORD xPos,yPos,zPos;
|
|||
|
||||
/* Which way are we facing? */
|
||||
worldAngle = trackingCamera.rotation.y;
|
||||
separation = (FRACT) ((yConcern - worldAngle));
|
||||
separation = (float) ((yConcern - worldAngle));
|
||||
if(separation < DEG(-180))
|
||||
{
|
||||
separation += DEG(360);
|
||||
|
@ -1117,7 +1117,7 @@ SDWORD xPos,yPos,zPos;
|
|||
trackingCamera.rotation.x+=DEG(360);
|
||||
}
|
||||
worldAngle = trackingCamera.rotation.x;
|
||||
separation = (FRACT) ((xConcern - worldAngle));
|
||||
separation = (float) ((xConcern - worldAngle));
|
||||
|
||||
MODFRACT(separation,DEG(360));
|
||||
|
||||
|
@ -1133,7 +1133,7 @@ SDWORD xPos,yPos,zPos;
|
|||
/* Make new acceleration */
|
||||
trackingCamera.rotAccel.x =
|
||||
/* Make this really slow */
|
||||
((rotAccelConstant)*separation - rotVelocityConstant*(FRACT)trackingCamera.rotVel.x);
|
||||
((rotAccelConstant)*separation - rotVelocityConstant*(float)trackingCamera.rotVel.x);
|
||||
}
|
||||
|
||||
/* This looks a bit arse - looks like a flight sim */
|
||||
|
@ -1152,7 +1152,7 @@ SDWORD xPos,yPos,zPos;
|
|||
trackingCamera.rotation.z+=DEG(360);
|
||||
}
|
||||
worldAngle = trackingCamera.rotation.z;
|
||||
separation = (FRACT) ((zConcern - worldAngle));
|
||||
separation = (float) ((zConcern - worldAngle));
|
||||
if(separation<DEG(-180))
|
||||
{
|
||||
separation+=DEG(360);
|
||||
|
@ -1165,7 +1165,7 @@ SDWORD xPos,yPos,zPos;
|
|||
/* Make new acceleration */
|
||||
trackingCamera.rotAccel.z =
|
||||
/* Make this really slow */
|
||||
((rotAccelConstant/1)*separation - rotVelocityConstant*(FRACT)trackingCamera.rotVel.z);
|
||||
((rotAccelConstant/1)*separation - rotVelocityConstant*(float)trackingCamera.rotVel.z);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1176,22 +1176,22 @@ SDWORD xPos,yPos,zPos;
|
|||
static void updateCameraRotationVelocity( UBYTE update )
|
||||
{
|
||||
//UDWORD frameTime;
|
||||
FRACT fraction;
|
||||
float fraction;
|
||||
|
||||
// frameTime = gameTime - trackingCamera.lastUpdate;
|
||||
fraction = (MAKEFRACT(frameTime2) / (FRACT)GAME_TICKS_PER_SEC);
|
||||
fraction = (MAKEFRACT(frameTime2) / (float)GAME_TICKS_PER_SEC);
|
||||
|
||||
if(update & Y_UPDATE)
|
||||
{
|
||||
trackingCamera.rotVel.y += ((FRACT)trackingCamera.rotAccel.y * fraction);
|
||||
trackingCamera.rotVel.y += ((float)trackingCamera.rotAccel.y * fraction);
|
||||
}
|
||||
if(update & X_UPDATE)
|
||||
{
|
||||
trackingCamera.rotVel.x += ((FRACT)trackingCamera.rotAccel.x * fraction);
|
||||
trackingCamera.rotVel.x += ((float)trackingCamera.rotAccel.x * fraction);
|
||||
}
|
||||
if(update & Z_UPDATE)
|
||||
{
|
||||
trackingCamera.rotVel.z += ((FRACT)trackingCamera.rotAccel.z * fraction);
|
||||
trackingCamera.rotVel.z += ((float)trackingCamera.rotAccel.z * fraction);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1201,10 +1201,10 @@ FRACT fraction;
|
|||
static void updateCameraRotationPosition( UBYTE update )
|
||||
{
|
||||
//UDWORD frameTime;
|
||||
FRACT fraction;
|
||||
float fraction;
|
||||
|
||||
// frameTime = gameTime - trackingCamera.lastUpdate;
|
||||
fraction = (MAKEFRACT(frameTime2) / (FRACT)GAME_TICKS_PER_SEC);
|
||||
fraction = (MAKEFRACT(frameTime2) / (float)GAME_TICKS_PER_SEC);
|
||||
|
||||
if(update & Y_UPDATE)
|
||||
{
|
||||
|
|
|
@ -96,7 +96,7 @@ extern SDWORD getPresAngle( void );
|
|||
extern UDWORD getNumDroidsSelected( void );
|
||||
extern void camAllignWithTarget(BASE_OBJECT *psTarget);
|
||||
|
||||
extern FRACT accelConstant,velocityConstant, rotAccelConstant, rotVelocityConstant;
|
||||
extern float accelConstant,velocityConstant, rotAccelConstant, rotVelocityConstant;
|
||||
extern UDWORD getTestAngle(void);
|
||||
void updateTestAngle( void );
|
||||
#define BEHIND_DROID_DIRECTION(d) (360-((d->direction+180)%360))
|
||||
|
|
Loading…
Reference in New Issue