* Remove macros:
* ROUND: replace by a static inline function (math_round) instead * FRACTCONST: this macro just cast both of its arguments to float and then divide the first by the second * MAKEFRACT_D: this macro would cast to FRACT_D (which was typedef'd as float but should have been typedef'd as double); so cast to double instead (where required) * FRACTmul_D: would cast both of its arguments to FRACT_D and multiply them * FRACTdiv_D: would cast both of its arguments to FRACT_D and divide the first by the second * MAKEINT & MAKEINT_D (where #defined the same); this macro would just cast to SDWORD (aka "int" or "signed int") git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3152 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
e8be7978e6
commit
fbf03af195
|
@ -25,12 +25,8 @@
|
|||
// - This is defined as a float on PC and a 20.12 fixed point number on PSX
|
||||
//
|
||||
// Use:-
|
||||
// MAKEINT(fract); to convert the other way
|
||||
// SQRT(fract); to get square root of a fract (returns a fract)
|
||||
// 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)
|
||||
//
|
||||
// Also PERCENT(int,int); // returns a int value 0->100 of the percentage of the first param over the second
|
||||
//
|
||||
|
@ -60,16 +56,13 @@
|
|||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
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 FRACTCONST(a,b) (((float)(a)) / ((float)(b)))
|
||||
#define MAKEFRACT_D(x) ((FRACT_D)(x))
|
||||
#define FRACTmul_D(x,y) ((double)(x)*(double)(y))
|
||||
#define FRACTdiv_D(x,y) ((double)(x)/(double)(y))
|
||||
|
||||
#define MAKEINT_D(x) ((SDWORD)(x))
|
||||
#define MAKEINT(x) ((SDWORD)(x))
|
||||
static inline int math_round(float x)
|
||||
{
|
||||
// Ensure that float truncation results in a proper rounding
|
||||
if (x < 0.f)
|
||||
return x - 0.5f;
|
||||
else
|
||||
return x + 0.5f;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -651,7 +651,7 @@ BOOL actionVisibleTarget(DROID *psDroid, BASE_OBJECT *psTarget, int weapon_slot)
|
|||
|
||||
static void actionAddVtolAttackRun( DROID *psDroid )
|
||||
{
|
||||
FRACT_D fA;
|
||||
double fA;
|
||||
SDWORD deltaX, deltaY, iA, iX, iY;
|
||||
BASE_OBJECT *psTarget;
|
||||
#if 0
|
||||
|
@ -679,7 +679,7 @@ static void actionAddVtolAttackRun( DROID *psDroid )
|
|||
|
||||
/* get magnitude of normal vector (Pythagorean theorem) */
|
||||
fA = trigIntSqrt( deltaX*deltaX + deltaY*deltaY );
|
||||
iA = MAKEINT(fA);
|
||||
iA = fA;
|
||||
|
||||
#if 0
|
||||
/* get left perpendicular to normal vector:
|
||||
|
|
|
@ -94,7 +94,7 @@ static void processAVTile(UDWORD x, UDWORD y)
|
|||
}
|
||||
|
||||
time = (float)frameTime / (float)GAME_TICKS_PER_SEC;
|
||||
newLevel = MAKEINT(psTile->level + (time * FADE_IN_TIME));
|
||||
newLevel = (int)(psTile->level + (time * FADE_IN_TIME));
|
||||
if (newLevel >= psTile->illumination)
|
||||
{
|
||||
psTile->level = psTile->illumination;
|
||||
|
|
17
src/atmos.c
17
src/atmos.c
|
@ -191,10 +191,11 @@ void processParticle( ATPART *psPart )
|
|||
if(psPart->position.y < 255*ELEVATION_SCALE)
|
||||
{
|
||||
/* Get ground height */
|
||||
groundHeight = map_Height((UDWORD)MAKEINT(psPart->position.x),(UDWORD)MAKEINT(psPart->position.z));
|
||||
groundHeight = map_Height(psPart->position.x, psPart->position.z);
|
||||
|
||||
/* Are we below ground? */
|
||||
if( (MAKEINT(psPart->position.y) < groundHeight) || (psPart->position.y<0.0f) )
|
||||
if ((int)psPart->position.y < groundHeight
|
||||
|| psPart->position.y < 0.f)
|
||||
{
|
||||
/* Kill it and return */
|
||||
psPart->status = APS_INACTIVE;
|
||||
|
@ -205,8 +206,8 @@ void processParticle( ATPART *psPart )
|
|||
psTile = mapTile(x,y);
|
||||
if (terrainType(psTile) == TER_WATER && TEST_TILE_VISIBLE(selectedPlayer,psTile))
|
||||
{
|
||||
pos.x = MAKEINT(psPart->position.x);
|
||||
pos.z = MAKEINT(psPart->position.z);
|
||||
pos.x = psPart->position.x;
|
||||
pos.z = psPart->position.z;
|
||||
pos.y = groundHeight;
|
||||
effectSetSize(60);
|
||||
addEffect(&pos,EFFECT_EXPLOSION,EXPLOSION_TYPE_SPECIFIED,TRUE,getImdFromIndex(MI_SPLASH),0);
|
||||
|
@ -317,7 +318,7 @@ UDWORD i;
|
|||
if(asAtmosParts[i].status == APS_ACTIVE)
|
||||
{
|
||||
/* Is it on the grid */
|
||||
if(clipXY((UDWORD)MAKEINT(asAtmosParts[i].position.x),(UDWORD)MAKEINT(asAtmosParts[i].position.z)))
|
||||
if (clipXY(asAtmosParts[i].position.x, asAtmosParts[i].position.z))
|
||||
{
|
||||
renderParticle(&asAtmosParts[i]);
|
||||
}
|
||||
|
@ -332,9 +333,9 @@ void renderParticle( ATPART *psPart )
|
|||
SDWORD centreX, centreZ;
|
||||
SDWORD x, y, z, rx, rz;
|
||||
|
||||
x = MAKEINT(psPart->position.x);
|
||||
y = MAKEINT(psPart->position.y);
|
||||
z = MAKEINT(psPart->position.z);
|
||||
x = psPart->position.x;
|
||||
y = psPart->position.y;
|
||||
z = psPart->position.z;
|
||||
/* Transform it */
|
||||
dv.x = ((UDWORD)x - player.p.x) - terrainMidX * TILE_UNITS;
|
||||
dv.y = (UDWORD)y;
|
||||
|
|
|
@ -157,14 +157,14 @@ extern BOOL bucketAddTypeToList(RENDER_TYPE objectType, void* pObject)
|
|||
{
|
||||
/* Won't draw selection boxes */
|
||||
DROID *psDroid = (DROID*)pObject;
|
||||
|
||||
|
||||
psDroid->sDisplay.frameNumber = 0;
|
||||
}
|
||||
else if(objectType == RENDER_STRUCTURE)
|
||||
{
|
||||
/* Won't draw selection boxes */
|
||||
STRUCTURE *psStructure = (STRUCTURE*)pObject;
|
||||
|
||||
|
||||
psStructure->sDisplay.frameNumber = 0;
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ extern BOOL bucketAddTypeToList(RENDER_TYPE objectType, void* pObject)
|
|||
newTag->psNextTag = bucketArray[z];
|
||||
newTag->actualZ = z;
|
||||
bucketArray[z] = newTag;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -290,9 +290,9 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject)
|
|||
/* Translate */
|
||||
iV_TRANSLATE(px,0,-pz);
|
||||
|
||||
position.x = (UDWORD)MAKEINT(((ATPART*)pObject)->position.x);
|
||||
position.y = (UDWORD)MAKEINT(((ATPART*)pObject)->position.y);
|
||||
position.z = (UDWORD)MAKEINT(((ATPART*)pObject)->position.z);
|
||||
position.x = ((ATPART*)pObject)->position.x;
|
||||
position.y = ((ATPART*)pObject)->position.y;
|
||||
position.z = ((ATPART*)pObject)->position.z;
|
||||
|
||||
position.x = (SDWORD)(position.x - player.p.x) - terrainMidX*TILE_UNITS;
|
||||
position.z = (SDWORD)(terrainMidY*TILE_UNITS - (position.z - player.p.z));
|
||||
|
@ -384,7 +384,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject)
|
|||
}
|
||||
|
||||
z = pie_RotateProject(&position,&pixel);
|
||||
|
||||
|
||||
if (z > 0)
|
||||
{
|
||||
//particle use the image radius
|
||||
|
|
|
@ -52,24 +52,24 @@ void setDifficultyLevel(DIFFICULTY_LEVEL lev)
|
|||
switch(lev)
|
||||
{
|
||||
case DL_EASY:
|
||||
fDifPlayerModifier = FRACTCONST(120,100);
|
||||
fDifEnemyModifier = FRACTCONST(100,100);
|
||||
fDifPlayerModifier = 120.f / 100.f;
|
||||
fDifEnemyModifier = 100.f / 100.f;
|
||||
break;
|
||||
case DL_NORMAL:
|
||||
fDifPlayerModifier = FRACTCONST(100,100);
|
||||
fDifEnemyModifier = FRACTCONST(100,100);
|
||||
fDifPlayerModifier = 100.f / 100.f;
|
||||
fDifEnemyModifier = 100.f / 100.f;
|
||||
break;
|
||||
case DL_HARD:
|
||||
fDifPlayerModifier = FRACTCONST(80,100);
|
||||
fDifEnemyModifier = FRACTCONST(100,100);
|
||||
fDifPlayerModifier = 80.f / 100.f;
|
||||
fDifEnemyModifier = 100.f / 100.f;
|
||||
break;
|
||||
case DL_KILLER:
|
||||
fDifPlayerModifier = FRACTCONST(999,100); // 10 times
|
||||
fDifEnemyModifier = FRACTCONST(1,100); // almost nothing
|
||||
fDifPlayerModifier = 999.f / 100.f; // 10 times
|
||||
fDifEnemyModifier = 1.f / 100.f; // almost nothing
|
||||
break;
|
||||
case DL_TOUGH:
|
||||
fDifPlayerModifier = FRACTCONST(100,100);
|
||||
fDifEnemyModifier = FRACTCONST(50,100); // they do less damage!
|
||||
fDifPlayerModifier = 100.f / 100.f;
|
||||
fDifEnemyModifier = 50.f / 100.f; // they do less damage!
|
||||
break;
|
||||
default:
|
||||
debug( LOG_ERROR, "Invalid difficulty level selected - forcing NORMAL" );
|
||||
|
@ -88,16 +88,11 @@ DIFFICULTY_LEVEL getDifficultyLevel( void )
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
SDWORD modifyForDifficultyLevel(SDWORD basicVal,BOOL IsPlayer)
|
||||
int modifyForDifficultyLevel(int basicVal, bool IsPlayer)
|
||||
{
|
||||
SDWORD retVal;
|
||||
|
||||
if(IsPlayer) {
|
||||
retVal = (SDWORD)ROUND(basicVal*fDifPlayerModifier);
|
||||
} else {
|
||||
retVal = (SDWORD)ROUND(basicVal*fDifEnemyModifier);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
if (IsPlayer)
|
||||
return math_round(basicVal * fDifPlayerModifier);
|
||||
else
|
||||
return math_round(basicVal * fDifEnemyModifier);
|
||||
}
|
||||
// ------------------------------------------------------------------------------------
|
||||
|
|
|
@ -20,18 +20,21 @@
|
|||
#ifndef _difficulty_h
|
||||
#define _difficulty_h
|
||||
|
||||
// required to ensure "types.h" is included the proper way (we need the "bool" type)
|
||||
#include "lib/framework/frame.h"
|
||||
|
||||
typedef enum _difficulty_level
|
||||
{
|
||||
DL_EASY,
|
||||
DL_NORMAL,
|
||||
DL_HARD,
|
||||
DL_TOUGH,
|
||||
DL_KILLER
|
||||
DL_EASY,
|
||||
DL_NORMAL,
|
||||
DL_HARD,
|
||||
DL_TOUGH,
|
||||
DL_KILLER
|
||||
} DIFFICULTY_LEVEL;
|
||||
|
||||
extern void setDifficultyLevel( DIFFICULTY_LEVEL lev);
|
||||
extern DIFFICULTY_LEVEL getDifficultyLevel( void );
|
||||
extern SDWORD modifyForDifficultyLevel(SDWORD basicVal,BOOL IsPlayer);
|
||||
extern int modifyForDifficultyLevel(int basicVal, bool IsPlayer);
|
||||
extern void setModifiers(float Player,float Enemy);
|
||||
|
||||
|
||||
|
|
|
@ -675,7 +675,7 @@ static void HandleDrag(void)
|
|||
dragBox3D.x2 = mouseXPos;
|
||||
dragBox3D.y1 = dragY;
|
||||
dragBox3D.y2 = mouseYPos;
|
||||
|
||||
|
||||
dragBox3D.status = DRAG_DRAGGING;
|
||||
}
|
||||
|
||||
|
@ -1168,9 +1168,9 @@ void scroll(void)
|
|||
sine = sinf(radians);
|
||||
|
||||
/* Get x component of movement */
|
||||
xDif = ROUND(cosine * scrollStepLeftRight + sine * scrollStepUpDown);
|
||||
xDif = math_round(cosine * scrollStepLeftRight + sine * scrollStepUpDown);
|
||||
/* Get y component of movement */
|
||||
yDif = ROUND(sine * scrollStepLeftRight - cosine * scrollStepUpDown);
|
||||
yDif = math_round(sine * scrollStepLeftRight - cosine * scrollStepUpDown);
|
||||
|
||||
/* Adjust player's position by these components */
|
||||
player.p.x += xDif;
|
||||
|
|
|
@ -361,7 +361,7 @@ void draw3DScene( void )
|
|||
{
|
||||
unsigned int width, height;
|
||||
const char *Qbuf, *Lbuf, *Abuf;
|
||||
|
||||
|
||||
sasprintf((char**)&Qbuf,"Que: %04u",audio_GetSampleQueueCount());
|
||||
sasprintf((char**)&Lbuf,"Lst: %04u",audio_GetSampleListCount());
|
||||
sasprintf((char**)&Abuf,"Act: %04u",sound_GetActiveSamplesCount());
|
||||
|
@ -2191,7 +2191,7 @@ void renderStructure(STRUCTURE *psStructure)
|
|||
iIMDShape *lImd;
|
||||
|
||||
iV_MatrixBegin();
|
||||
iV_TRANSLATE(psStructure->sDisplay.imd->connectors->x, psStructure->sDisplay.imd->connectors->z,
|
||||
iV_TRANSLATE(psStructure->sDisplay.imd->connectors->x, psStructure->sDisplay.imd->connectors->z,
|
||||
psStructure->sDisplay.imd->connectors->y);
|
||||
lImd = getImdFromIndex(MI_LANDING);
|
||||
pie_Draw3DShape(lImd, getStaticTimeValueRange(1024, lImd->numFrames), 0, buildingBrightness, WZCOL_BLACK, 0, 0);
|
||||
|
@ -2554,9 +2554,9 @@ static void drawWeaponReloadBar(BASE_OBJECT *psObj, WEAPON *psWeap, int weapon_s
|
|||
}
|
||||
else
|
||||
{
|
||||
mulH = 100;
|
||||
mulH = 100.f;
|
||||
}
|
||||
firingStage = MAKEINT(mulH);
|
||||
firingStage = mulH;
|
||||
firingStage = ((((2*scrR)*10000)/100)*firingStage)/10000;
|
||||
if(firingStage >= (UDWORD)(2*scrR))
|
||||
{
|
||||
|
@ -2728,12 +2728,12 @@ static void drawStructureSelections( void )
|
|||
}
|
||||
mulH = (float)health / 100.f;
|
||||
mulH *= (float)width;
|
||||
health = MAKEINT(mulH);
|
||||
health = mulH;
|
||||
if(health>width) health = width;
|
||||
health*=2;
|
||||
pie_BoxFill(scrX-scrR - 1, scrY - 1, scrX + scrR + 1, scrY + 2, WZCOL_RELOAD_BACKGROUND);
|
||||
pie_BoxFill(scrX-scrR, scrY, scrX - scrR + health, scrY + 1, powerCol);
|
||||
|
||||
|
||||
for (i = 0; i < psStruct->numWeaps; i++)
|
||||
{
|
||||
drawWeaponReloadBar((BASE_OBJECT *)psStruct, &psStruct->asWeaps[i], i);
|
||||
|
@ -2757,7 +2757,7 @@ static void drawStructureSelections( void )
|
|||
powerCol = WZCOL_YELLOW;
|
||||
mulH = (float)health / 100.f;
|
||||
mulH *= (float)width;
|
||||
health = MAKEINT(mulH);
|
||||
health = mulH;
|
||||
if (health > width)
|
||||
{
|
||||
health = width;
|
||||
|
@ -2975,7 +2975,7 @@ static void drawDroidSelections( void )
|
|||
powerCol = WZCOL_HEALTH_LOW;
|
||||
}
|
||||
mulH = (float)psDroid->body / (float)psDroid->originalBody;
|
||||
damage = MAKEINT(mulH * (float)psDroid->sDisplay.screenR);// (((psDroid->sDisplay.screenR*10000)/100)*damage)/10000;
|
||||
damage = mulH * (float)psDroid->sDisplay.screenR;// (((psDroid->sDisplay.screenR*10000)/100)*damage)/10000;
|
||||
if(damage>psDroid->sDisplay.screenR) damage = psDroid->sDisplay.screenR;
|
||||
|
||||
damage *=2;
|
||||
|
@ -3001,7 +3001,7 @@ static void drawDroidSelections( void )
|
|||
pie_BoxFill(scrX + scrR - 7, scrY + scrR, scrX + scrR, scrY + scrR + 1, boxCol);
|
||||
pie_BoxFill(scrX + scrR, scrY + scrR - 7, scrX + scrR + 1, scrY + scrR + 1, boxCol);
|
||||
}
|
||||
|
||||
|
||||
/* Power bars */
|
||||
pie_BoxFill(scrX - scrR - 1, scrY + scrR+2, scrX + scrR + 1, scrY + scrR + 5, WZCOL_RELOAD_BACKGROUND);
|
||||
pie_BoxFill(scrX - scrR, scrY + scrR+3, scrX - scrR + damage, scrY + scrR + 4, powerCol);
|
||||
|
@ -3087,7 +3087,7 @@ static void drawDroidSelections( void )
|
|||
{
|
||||
mulH = (float)psDroid->body / (float)psDroid->originalBody;
|
||||
}
|
||||
damage = MAKEINT(mulH * (float)psDroid->sDisplay.screenR);// (((psDroid->sDisplay.screenR*10000)/100)*damage)/10000;
|
||||
damage = mulH * (float)psDroid->sDisplay.screenR;// (((psDroid->sDisplay.screenR*10000)/100)*damage)/10000;
|
||||
if(damage>psDroid->sDisplay.screenR) damage = psDroid->sDisplay.screenR;
|
||||
damage *=2;
|
||||
scrX = psDroid->sDisplay.screenX;
|
||||
|
@ -4578,7 +4578,7 @@ static void addConstructionLine(DROID *psDroid, STRUCTURE *psStructure)
|
|||
point = &(psStructure->sDisplay.imd->points[pointIndex]);
|
||||
|
||||
each.x = psStructure->pos.x + point->x;
|
||||
realY = MAKEINT((structHeightScale(psStructure) * point->y));
|
||||
realY = structHeightScale(psStructure) * point->y;
|
||||
each.y = psStructure->pos.z + realY;
|
||||
each.z = psStructure->pos.y - point->z;
|
||||
|
||||
|
@ -4602,7 +4602,7 @@ static void addConstructionLine(DROID *psDroid, STRUCTURE *psStructure)
|
|||
point = &(psStructure->sDisplay.imd->points[pointIndex]);
|
||||
|
||||
each.x = psStructure->pos.x + point->x;
|
||||
realY = MAKEINT((structHeightScale(psStructure) * point->y));
|
||||
realY = structHeightScale(psStructure) * point->y;
|
||||
each.y = psStructure->pos.z + realY;
|
||||
each.z = psStructure->pos.y - point->z;
|
||||
|
||||
|
|
18
src/droid.c
18
src/droid.c
|
@ -1448,14 +1448,14 @@ BOOL droidUpdateBuild(DROID *psDroid)
|
|||
//ILLUMINATION ISN'T BEING DONE ANYMORE
|
||||
/*
|
||||
//reserve the previous value
|
||||
prevScale= (UBYTE) MAKEINT(psStruct->heightScale*100);
|
||||
prev = (UBYTE)(prevScale / (UBYTE)10);
|
||||
prevScale = psStruct->heightScale * 100.f;
|
||||
prev = prevScale / 10;
|
||||
|
||||
psStruct->currentBuildPts += (pointsToAdd - psDroid->actionPoints);
|
||||
psStruct->heightScale = (float)psStruct->currentBuildPts / psStruct->pStructureType->buildPoints;
|
||||
|
||||
currScale = (UBYTE) MAKEINT(psStruct->heightScale * 100);
|
||||
current = (UBYTE)(currScale / (UBYTE)10);
|
||||
currScale = psStruct->heightScale * 100.f;
|
||||
current = currScale / 10;
|
||||
|
||||
if (current != prev)
|
||||
{
|
||||
|
@ -2021,7 +2021,7 @@ UBYTE num_weapons = 0;
|
|||
fraction =
|
||||
(float)asWeaponStats[psDroid->asWeaps[i].nStat].recoilValue / 100.f;
|
||||
|
||||
recoil = MAKEINT((float)recoil * fraction);
|
||||
recoil = (float)recoil * fraction;
|
||||
|
||||
/* Put it into the weapon data */
|
||||
psDroid->asWeaps[i].recoilValue = recoil;
|
||||
|
@ -3213,7 +3213,7 @@ UDWORD calcDroidPower(DROID *psDroid)
|
|||
UDWORD calcDroidPoints(DROID *psDroid)
|
||||
{
|
||||
int points, i;
|
||||
|
||||
|
||||
points = getBodyStats(psDroid)->buildPoints;
|
||||
points += getBrainStats(psDroid)->buildPoints;
|
||||
points += getPropulsionStats(psDroid)->buildPoints;
|
||||
|
@ -3221,12 +3221,12 @@ UDWORD calcDroidPoints(DROID *psDroid)
|
|||
points += getECMStats(psDroid)->buildPoints;
|
||||
points += getRepairStats(psDroid)->buildPoints;
|
||||
points += getConstructStats(psDroid)->buildPoints;
|
||||
|
||||
|
||||
for (i = 0; i < psDroid->numWeaps; i++)
|
||||
{
|
||||
points += (asWeaponStats + psDroid->asWeaps[i].nStat)->buildPoints;
|
||||
}
|
||||
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
|
@ -3932,7 +3932,7 @@ BOOL calcDroidMuzzleLocation(DROID *psDroid, Vector3i *muzzle, int weapon_slot)
|
|||
CHECK_DROID(psDroid);
|
||||
|
||||
psShape = BODY_IMD(psDroid,psDroid->player);
|
||||
|
||||
|
||||
psWeapon = (asWeaponStats[psDroid->asWeaps[weapon_slot].nStat]).pIMD;
|
||||
psWeaponMount = (asWeaponStats[psDroid->asWeaps[weapon_slot].nStat]).pMountGraphic;
|
||||
if(psShape && psShape->nconnectors)
|
||||
|
|
218
src/effects.c
218
src/effects.c
|
@ -176,9 +176,9 @@ static void positionEffect(EFFECT *psEffect)
|
|||
SDWORD rx, rz;
|
||||
|
||||
/* Establish world position */
|
||||
dv.x = ((UDWORD)MAKEINT(psEffect->position.x) - player.p.x) - terrainMidX * TILE_UNITS;
|
||||
dv.y = (UDWORD)MAKEINT(psEffect->position.y);
|
||||
dv.z = terrainMidY * TILE_UNITS - ((UDWORD)MAKEINT(psEffect->position.z) - player.p.z);
|
||||
dv.x = (psEffect->position.x - player.p.x) - terrainMidX * TILE_UNITS;
|
||||
dv.y = psEffect->position.y;
|
||||
dv.z = terrainMidY * TILE_UNITS - (psEffect->position.z - player.p.z);
|
||||
|
||||
/* Push the indentity matrix */
|
||||
iV_MatrixBegin();
|
||||
|
@ -366,8 +366,8 @@ void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specifie
|
|||
}
|
||||
|
||||
/* Quick optimsation to reject every second non-essential effect if it's off grid */
|
||||
// if(clipXY((UDWORD)MAKEINT(pos->pos.x),(UDWORD)MAKEINT(pos->pos.z)) == FALSE)
|
||||
if(clipXY((UDWORD)pos->x,(UDWORD)pos->z) == FALSE)
|
||||
// if(clipXY(pos->pos.x, pos->pos.z) == FALSE)
|
||||
if(clipXY(pos->x, pos->z) == FALSE)
|
||||
{
|
||||
/* If effect is essentail - then let it through */
|
||||
if(!essentialEffect(group,type) )
|
||||
|
@ -586,7 +586,7 @@ void processEffects(void)
|
|||
/* One more is active */
|
||||
numEffects++;
|
||||
/* Is it on the grid */
|
||||
if(clipXY((UDWORD)MAKEINT(asEffectsList[i].position.x),(UDWORD)MAKEINT(asEffectsList[i].position.z)))
|
||||
if (clipXY(asEffectsList[i].position.x, asEffectsList[i].position.z))
|
||||
{
|
||||
/* Add it to the bucket */
|
||||
bucketAddTypeToList(RENDER_EFFECT,&asEffectsList[i]);
|
||||
|
@ -690,14 +690,14 @@ static void updateFirework(EFFECT *psEffect)
|
|||
|
||||
if(psEffect->type == FIREWORK_TYPE_LAUNCHER)
|
||||
{
|
||||
height = MAKEINT(psEffect->position.y);
|
||||
height = psEffect->position.y;
|
||||
if(height > psEffect->size)
|
||||
{
|
||||
dv.x = MAKEINT(psEffect->position.x);
|
||||
dv.z = MAKEINT(psEffect->position.z);
|
||||
dv.y = MAKEINT(psEffect->position.y) + (psEffect->radius/2);
|
||||
dv.x = psEffect->position.x;
|
||||
dv.z = psEffect->position.z;
|
||||
dv.y = psEffect->position.y + (psEffect->radius / 2);
|
||||
addEffect(&dv,EFFECT_EXPLOSION,EXPLOSION_TYPE_MEDIUM,FALSE,NULL,0);
|
||||
audio_PlayStaticTrack( MAKEINT(psEffect->position.x), MAKEINT(psEffect->position.z), ID_SOUND_EXPLOSION );
|
||||
audio_PlayStaticTrack(psEffect->position.x, psEffect->position.z, ID_SOUND_EXPLOSION);
|
||||
|
||||
for(dif =0; dif < (psEffect->radius*2); dif+=20)
|
||||
{
|
||||
|
@ -717,24 +717,24 @@ static void updateFirework(EFFECT *psEffect)
|
|||
yDif = radius * (COS(DEG(val)));
|
||||
xDif = xDif/4096; // cos it's fixed point
|
||||
yDif = yDif/4096;
|
||||
dv.x = MAKEINT(psEffect->position.x)+xDif;
|
||||
dv.z = MAKEINT(psEffect->position.z)+yDif;
|
||||
dv.y = MAKEINT(psEffect->position.y)+dif;
|
||||
dv.x = psEffect->position.x + xDif;
|
||||
dv.z = psEffect->position.z + yDif;
|
||||
dv.y = psEffect->position.y + dif;
|
||||
effectGiveAuxVar(100);
|
||||
addEffect(&dv,EFFECT_FIREWORK, FIREWORK_TYPE_STARBURST,FALSE,NULL,0);
|
||||
dv.x = MAKEINT(psEffect->position.x)-xDif;
|
||||
dv.z = MAKEINT(psEffect->position.z)-yDif;
|
||||
dv.y = MAKEINT(psEffect->position.y)+dif;
|
||||
dv.x = psEffect->position.x - xDif;
|
||||
dv.z = psEffect->position.z - yDif;
|
||||
dv.y = psEffect->position.y + dif;
|
||||
effectGiveAuxVar(100);
|
||||
addEffect(&dv,EFFECT_FIREWORK, FIREWORK_TYPE_STARBURST,FALSE,NULL,0);
|
||||
dv.x = MAKEINT(psEffect->position.x)+xDif;
|
||||
dv.z = MAKEINT(psEffect->position.z)-yDif;
|
||||
dv.y = MAKEINT(psEffect->position.y)+dif;
|
||||
dv.x = psEffect->position.x + xDif;
|
||||
dv.z = psEffect->position.z - yDif;
|
||||
dv.y = psEffect->position.y + dif;
|
||||
effectGiveAuxVar(100);
|
||||
addEffect(&dv,EFFECT_FIREWORK, FIREWORK_TYPE_STARBURST,FALSE,NULL,0);
|
||||
dv.x = MAKEINT(psEffect->position.x)-xDif;
|
||||
dv.z = MAKEINT(psEffect->position.z)+yDif;
|
||||
dv.y = MAKEINT(psEffect->position.y)+dif;
|
||||
dv.x = psEffect->position.x - xDif;
|
||||
dv.z = psEffect->position.z + yDif;
|
||||
dv.y = psEffect->position.y + dif;
|
||||
effectGiveAuxVar(100);
|
||||
addEffect(&dv,EFFECT_FIREWORK, FIREWORK_TYPE_STARBURST,FALSE,NULL,0);
|
||||
|
||||
|
@ -750,9 +750,9 @@ static void updateFirework(EFFECT *psEffect)
|
|||
else
|
||||
{
|
||||
/* Add an effect at the firework's position */
|
||||
dv.x = MAKEINT(psEffect->position.x);
|
||||
dv.y = MAKEINT(psEffect->position.y);
|
||||
dv.z = MAKEINT(psEffect->position.z);
|
||||
dv.x = psEffect->position.x;
|
||||
dv.y = psEffect->position.y;
|
||||
dv.z = psEffect->position.z;
|
||||
|
||||
/* Add a trail graphic */
|
||||
addEffect(&dv,EFFECT_SMOKE,SMOKE_TYPE_TRAIL,FALSE,NULL,0);
|
||||
|
@ -813,10 +813,10 @@ static void updateSatLaser(EFFECT *psEffect)
|
|||
LIGHT light;
|
||||
|
||||
// Do these here cause there used by the lighting code below this if.
|
||||
xPos = MAKEINT(psEffect->position.x);
|
||||
startHeight = MAKEINT(psEffect->position.y);
|
||||
xPos = psEffect->position.x;
|
||||
startHeight = psEffect->position.y;
|
||||
endHeight = startHeight+1064;
|
||||
yPos = MAKEINT(psEffect->position.z);
|
||||
yPos = psEffect->position.z;
|
||||
|
||||
if(psEffect->baseScale)
|
||||
{
|
||||
|
@ -833,7 +833,7 @@ static void updateSatLaser(EFFECT *psEffect)
|
|||
addEffect(&dv,EFFECT_EXPLOSION,EXPLOSION_TYPE_MEDIUM,FALSE,NULL,0);
|
||||
}
|
||||
/* Add a sound effect */
|
||||
audio_PlayStaticTrack( MAKEINT(psEffect->position.x), MAKEINT(psEffect->position.z), ID_SOUND_EXPLOSION );
|
||||
audio_PlayStaticTrack(psEffect->position.x, psEffect->position.z, ID_SOUND_EXPLOSION);
|
||||
|
||||
/* Add a shockwave */
|
||||
dv.x = xPos;
|
||||
|
@ -925,9 +925,9 @@ static void updateExplosion(EFFECT *psEffect)
|
|||
}
|
||||
|
||||
range = percent;
|
||||
light.position.x = MAKEINT(psEffect->position.x);
|
||||
light.position.y = MAKEINT(psEffect->position.y);
|
||||
light.position.z = MAKEINT(psEffect->position.z);
|
||||
light.position.x = psEffect->position.x;
|
||||
light.position.y = psEffect->position.y;
|
||||
light.position.z = psEffect->position.z;
|
||||
light.range = (3*range)/2;
|
||||
light.colour = LIGHT_RED;
|
||||
processLight(&light);
|
||||
|
@ -936,9 +936,9 @@ static void updateExplosion(EFFECT *psEffect)
|
|||
/*
|
||||
if(psEffect->type == EXPLOSION_TYPE_LAND_LIGHT)
|
||||
{
|
||||
light.position.x = MAKEINT(psEffect->position.x);
|
||||
light.position.y = MAKEINT(psEffect->position.y);
|
||||
light.position.z = MAKEINT(psEffect->position.z);
|
||||
light.position.x = psEffect->position.x;
|
||||
light.position.y = psEffect->position.y;
|
||||
light.position.z = psEffect->position.z;
|
||||
light.range = getTimeValueRange(1024,512);
|
||||
if(light.range>256) light.range = 512-light.range;
|
||||
light.colour = LIGHT_RED;
|
||||
|
@ -948,13 +948,13 @@ static void updateExplosion(EFFECT *psEffect)
|
|||
|
||||
if(psEffect->type == EXPLOSION_TYPE_SHOCKWAVE)
|
||||
{
|
||||
psEffect->size += MAKEINT((fraction*SHOCKWAVE_SPEED));
|
||||
psEffect->size += fraction * SHOCKWAVE_SPEED;
|
||||
scaling = (float)psEffect->size / (float)MAX_SHOCKWAVE_SIZE;
|
||||
psEffect->frameNumber = MAKEINT(scaling*EffectGetNumFrames(psEffect));
|
||||
psEffect->frameNumber = scaling * EffectGetNumFrames(psEffect);
|
||||
|
||||
light.position.x = MAKEINT(psEffect->position.x);
|
||||
light.position.y = MAKEINT(psEffect->position.y);
|
||||
light.position.z = MAKEINT(psEffect->position.z);
|
||||
light.position.x = psEffect->position.x;
|
||||
light.position.y = psEffect->position.y;
|
||||
light.position.z = psEffect->position.z;
|
||||
light.range = psEffect->size+200;
|
||||
light.colour = LIGHT_YELLOW;
|
||||
processLight(&light);
|
||||
|
@ -996,7 +996,7 @@ static void updateExplosion(EFFECT *psEffect)
|
|||
/* Tesla explosions are the only ones that rise, or indeed move */
|
||||
if(psEffect->type == EXPLOSION_TYPE_TESLA)
|
||||
{
|
||||
psEffect->position.y += (MAKEINT(psEffect->velocity.y) * fraction);
|
||||
psEffect->position.y += psEffect->velocity.y * fraction;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1098,9 +1098,9 @@ static void updateGraviton(EFFECT *psEffect)
|
|||
|
||||
if(psEffect->type!=GRAVITON_TYPE_GIBLET)
|
||||
{
|
||||
light.position.x = MAKEINT(psEffect->position.x);
|
||||
light.position.y = MAKEINT(psEffect->position.y);
|
||||
light.position.z = MAKEINT(psEffect->position.z);
|
||||
light.position.x = psEffect->position.x;
|
||||
light.position.y = psEffect->position.y;
|
||||
light.position.z = psEffect->position.z;
|
||||
light.range = 128;
|
||||
light.colour = LIGHT_YELLOW;
|
||||
processLight(&light);
|
||||
|
@ -1118,17 +1118,18 @@ static void updateGraviton(EFFECT *psEffect)
|
|||
psEffect->position.z += (psEffect->velocity.z * fraction);
|
||||
|
||||
/* If it's bounced/drifted off the map then kill it */
|
||||
if(((UDWORD)MAKEINT(psEffect->position.x)/TILE_UNITS >= mapWidth) ||
|
||||
(UDWORD)MAKEINT(psEffect->position.z)/TILE_UNITS >= mapHeight)
|
||||
if (map_coord(psEffect->position.x) >= mapWidth
|
||||
|| map_coord(psEffect->position.z) >= mapHeight)
|
||||
{
|
||||
killEffect(psEffect);
|
||||
return;
|
||||
}
|
||||
|
||||
groundHeight = map_Height((UDWORD)MAKEINT(psEffect->position.x),(UDWORD)MAKEINT(psEffect->position.z));
|
||||
groundHeight = map_Height(psEffect->position.x, psEffect->position.z);
|
||||
|
||||
/* If it's going up and it's still under the landscape, then remove it... */
|
||||
if(psEffect->position.y<groundHeight && MAKEINT(psEffect->velocity.y)>0)
|
||||
if (psEffect->position.y<groundHeight
|
||||
&& psEffect->velocity.y > 0)
|
||||
{
|
||||
killEffect(psEffect);
|
||||
return;
|
||||
|
@ -1146,9 +1147,9 @@ static void updateGraviton(EFFECT *psEffect)
|
|||
psEffect->lastFrame = gameTime;
|
||||
|
||||
/* Add an effect at the gravitons's position */
|
||||
dv.x = MAKEINT(psEffect->position.x);
|
||||
dv.y = MAKEINT(psEffect->position.y);
|
||||
dv.z = MAKEINT(psEffect->position.z);
|
||||
dv.x = psEffect->position.x;
|
||||
dv.y = psEffect->position.y;
|
||||
dv.z = psEffect->position.z;
|
||||
|
||||
/* Add a trail graphic */
|
||||
addEffect(&dv,EFFECT_SMOKE,SMOKE_TYPE_TRAIL,FALSE,NULL,0);
|
||||
|
@ -1164,32 +1165,32 @@ static void updateGraviton(EFFECT *psEffect)
|
|||
psEffect->lastFrame = gameTime;
|
||||
|
||||
/* Add an effect at the gravitons's position */
|
||||
dv.x = MAKEINT(psEffect->position.x);
|
||||
dv.y = MAKEINT(psEffect->position.y);
|
||||
dv.z = MAKEINT(psEffect->position.z);
|
||||
dv.x = psEffect->position.x;
|
||||
dv.y = psEffect->position.y;
|
||||
dv.z = psEffect->position.z;
|
||||
addEffect(&dv,EFFECT_BLOOD,BLOOD_TYPE_NORMAL,FALSE,NULL,0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Spin it round a bit */
|
||||
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);
|
||||
psEffect->rotation.x += (float)psEffect->spin.x * fraction;
|
||||
psEffect->rotation.y += (float)psEffect->spin.y * fraction;
|
||||
psEffect->rotation.z += (float)psEffect->spin.z * fraction;
|
||||
|
||||
/* Update velocity (and retarding of descent) according to present frame rate */
|
||||
accel = (GRAVITON_GRAVITY*fraction);
|
||||
psEffect->velocity.y += accel;
|
||||
|
||||
/* If it's bounced/drifted off the map then kill it */
|
||||
if((MAKEINT(psEffect->position.x) <= TILE_UNITS) ||
|
||||
MAKEINT(psEffect->position.z) <= TILE_UNITS)
|
||||
if ((int)psEffect->position.x <= TILE_UNITS
|
||||
|| (int)psEffect->position.z <= TILE_UNITS)
|
||||
{
|
||||
killEffect(psEffect);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Are we below it? - Hit the ground? */
|
||||
if( (MAKEINT(psEffect->position.y) < (SDWORD)groundHeight))
|
||||
if ((int)psEffect->position.y < (int)groundHeight)
|
||||
{
|
||||
psTile = mapTile(map_coord(psEffect->position.x), map_coord(psEffect->position.z));
|
||||
if (terrainType(psTile) == TER_WATER)
|
||||
|
@ -1199,10 +1200,11 @@ static void updateGraviton(EFFECT *psEffect)
|
|||
}
|
||||
else
|
||||
/* Are we falling - rather than rising? */
|
||||
if(MAKEINT(psEffect->velocity.y)<0)
|
||||
if((int)psEffect->velocity.y < 0)
|
||||
{
|
||||
/* Has it sufficient energy to keep bouncing? */
|
||||
if(abs(MAKEINT(psEffect->velocity.y))>16 && psEffect->specific <=2)
|
||||
if (abs(psEffect->velocity.y) > 16
|
||||
&& psEffect->specific <= 2)
|
||||
{
|
||||
psEffect->specific++;
|
||||
/* Half it's velocity */
|
||||
|
@ -1218,9 +1220,9 @@ static void updateGraviton(EFFECT *psEffect)
|
|||
if(psEffect->type!=GRAVITON_TYPE_GIBLET)
|
||||
{
|
||||
/* Remove the graviton and add an explosion */
|
||||
dv.x = MAKEINT(psEffect->position.x);
|
||||
dv.y = MAKEINT(psEffect->position.y+10);
|
||||
dv.z = MAKEINT(psEffect->position.z);
|
||||
dv.x = psEffect->position.x;
|
||||
dv.y = psEffect->position.y + 10;
|
||||
dv.z = psEffect->position.z;
|
||||
addEffect(&dv,EFFECT_EXPLOSION,EXPLOSION_TYPE_VERY_SMALL,FALSE,NULL,0);
|
||||
}
|
||||
killEffect(psEffect);
|
||||
|
@ -1254,9 +1256,9 @@ static void updateDestruction(EFFECT *psEffect)
|
|||
}
|
||||
range = 50 - abs(50-percent);
|
||||
|
||||
light.position.x = MAKEINT(psEffect->position.x);
|
||||
light.position.y = MAKEINT(psEffect->position.y);
|
||||
light.position.z = MAKEINT(psEffect->position.z);
|
||||
light.position.x = psEffect->position.x;
|
||||
light.position.y = psEffect->position.y;
|
||||
light.position.z = psEffect->position.z;
|
||||
if(psEffect->type == DESTRUCTION_TYPE_STRUCTURE)
|
||||
{
|
||||
light.range = range*10;
|
||||
|
@ -1288,9 +1290,9 @@ static void updateDestruction(EFFECT *psEffect)
|
|||
|
||||
if((gameTime - psEffect->birthTime) > (unsigned int)((9*psEffect->lifeSpan)/10))
|
||||
{
|
||||
pos.x = MAKEINT(psEffect->position.x);
|
||||
pos.z = MAKEINT(psEffect->position.z);
|
||||
pos.y = MAKEINT(psEffect->position.y);
|
||||
pos.x = psEffect->position.x;
|
||||
pos.z = psEffect->position.z;
|
||||
pos.y = psEffect->position.y;
|
||||
addEffect(&pos,EFFECT_EXPLOSION,EXPLOSION_TYPE_LARGE,FALSE,NULL,0);
|
||||
killEffect(psEffect);
|
||||
return;
|
||||
|
@ -1299,7 +1301,7 @@ static void updateDestruction(EFFECT *psEffect)
|
|||
div = 1.f - (float)(gameTime - psEffect->birthTime) / psEffect->lifeSpan;
|
||||
if(div < 0.f)
|
||||
div = 0.f;
|
||||
height = MAKEINT(div * psEffect->imd->max.y);
|
||||
height = div * psEffect->imd->max.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1340,13 +1342,13 @@ static void updateDestruction(EFFECT *psEffect)
|
|||
|
||||
|
||||
/* Find a position to dump it at */
|
||||
pos.x = MAKEINT(psEffect->position.x) + widthScatter - rand()%(2*widthScatter);
|
||||
pos.z = MAKEINT(psEffect->position.z) + breadthScatter - rand()%(2*breadthScatter);
|
||||
pos.y = MAKEINT(psEffect->position.y) + height + rand()%heightScatter;
|
||||
pos.x = psEffect->position.x + widthScatter - rand() % (2 * widthScatter);
|
||||
pos.z = psEffect->position.z + breadthScatter - rand() % (2 * breadthScatter);
|
||||
pos.y = psEffect->position.y + height + rand() % heightScatter;
|
||||
|
||||
if(psEffect->type == DESTRUCTION_TYPE_SKYSCRAPER)
|
||||
{
|
||||
pos.y = MAKEINT(psEffect->position.y) + height;
|
||||
pos.y = psEffect->position.y + height;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1401,8 +1403,8 @@ static void updateDestruction(EFFECT *psEffect)
|
|||
/* Add sound effect, but only if we're less than 3/4 of the way thru' destruction */
|
||||
if( gameTime < ((3*(psEffect->birthTime + psEffect->lifeSpan)/4)) )
|
||||
{
|
||||
iX = MAKEINT(psEffect->position.x);
|
||||
iY = MAKEINT(psEffect->position.z);
|
||||
iX = psEffect->position.x;
|
||||
iY = psEffect->position.z;
|
||||
audio_PlayStaticTrack( iX, iY, ID_SOUND_EXPLOSION );
|
||||
}
|
||||
break;
|
||||
|
@ -1450,8 +1452,8 @@ static void updateConstruction(EFFECT *psEffect)
|
|||
if(TEST_CYCLIC(psEffect))
|
||||
{
|
||||
/* Has it hit the ground */
|
||||
if(MAKEINT(psEffect->position.y) <=
|
||||
map_Height((UDWORD)MAKEINT(psEffect->position.x),(UDWORD)MAKEINT(psEffect->position.z)))
|
||||
if ((int)psEffect->position.y <=
|
||||
map_Height(psEffect->position.x, psEffect->position.z))
|
||||
{
|
||||
killEffect(psEffect);
|
||||
return;
|
||||
|
@ -1479,9 +1481,9 @@ static void updateFire(EFFECT *psEffect)
|
|||
percent = 100;
|
||||
}
|
||||
|
||||
light.position.x = MAKEINT(psEffect->position.x);
|
||||
light.position.y = MAKEINT(psEffect->position.y);
|
||||
light.position.z = MAKEINT(psEffect->position.z);
|
||||
light.position.x = psEffect->position.x;
|
||||
light.position.y = psEffect->position.y;
|
||||
light.position.z = psEffect->position.z;
|
||||
light.range = (percent*psEffect->radius*3)/100;
|
||||
light.colour = LIGHT_RED;
|
||||
processLight(&light);
|
||||
|
@ -1490,8 +1492,8 @@ static void updateFire(EFFECT *psEffect)
|
|||
if(gameTime - psEffect->lastFrame > psEffect->frameDelay)
|
||||
{
|
||||
psEffect->lastFrame = gameTime;
|
||||
pos.x = (MAKEINT(psEffect->position.x) + ((rand()%psEffect->radius) - (rand()%(2*psEffect->radius))));
|
||||
pos.z = (MAKEINT(psEffect->position.z) + ((rand()%psEffect->radius) - (rand()%(2*psEffect->radius))));
|
||||
pos.x = (psEffect->position.x + ((rand() % psEffect->radius) - (rand() % (2 * psEffect->radius))));
|
||||
pos.z = (psEffect->position.z + ((rand() % psEffect->radius) - (rand() % (2 * psEffect->radius))));
|
||||
pos.y = map_Height(pos.x,pos.z);
|
||||
|
||||
if(psEffect->type == FIRE_TYPE_SMOKY_BLUE)
|
||||
|
@ -1505,23 +1507,23 @@ static void updateFire(EFFECT *psEffect)
|
|||
|
||||
if(psEffect->type == FIRE_TYPE_SMOKY || psEffect->type == FIRE_TYPE_SMOKY_BLUE)
|
||||
{
|
||||
pos.x = (MAKEINT(psEffect->position.x) + ((rand()%psEffect->radius/2) - (rand()%(2*psEffect->radius/2))));
|
||||
pos.z = (MAKEINT(psEffect->position.z) + ((rand()%psEffect->radius/2) - (rand()%(2*psEffect->radius/2))));
|
||||
pos.x = (psEffect->position.x + ((rand() % psEffect->radius / 2) - (rand() % (2 * psEffect->radius / 2))));
|
||||
pos.z = (psEffect->position.z + ((rand() % psEffect->radius / 2) - (rand() % (2 * psEffect->radius / 2))));
|
||||
pos.y = map_Height(pos.x,pos.z);
|
||||
addEffect(&pos,EFFECT_SMOKE,SMOKE_TYPE_DRIFTING_HIGH,FALSE,NULL,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.x = (MAKEINT(psEffect->position.x) + ((rand()%psEffect->radius) - (rand()%(2*psEffect->radius))));
|
||||
pos.z = (MAKEINT(psEffect->position.z) + ((rand()%psEffect->radius) - (rand()%(2*psEffect->radius))));
|
||||
pos.x = (psEffect->position.x + ((rand() % psEffect->radius) - (rand() % (2 * psEffect->radius))));
|
||||
pos.z = (psEffect->position.z + ((rand() % psEffect->radius) - (rand() % (2 * psEffect->radius))));
|
||||
pos.y = map_Height(pos.x,pos.z);
|
||||
addEffect(&pos,EFFECT_EXPLOSION,EXPLOSION_TYPE_SMALL,FALSE,NULL,0);
|
||||
}
|
||||
|
||||
/*
|
||||
pos.x = MAKEINT(psEffect->position.x);
|
||||
pos.y = MAKEINT(psEffect->position.y);
|
||||
pos.z = MAKEINT(psEffect->position.z);
|
||||
pos.x = psEffect->position.x;
|
||||
pos.y = psEffect->position.y;
|
||||
pos.z = psEffect->position.z;
|
||||
|
||||
scatter.x = psEffect->radius; scatter.y = 0; scatter.z = psEffect->radius;
|
||||
addMultiEffect(&pos,&scatter,EFFECT_EXPLOSION,EXPLOSION_TYPE_SMALL,FALSE,NULL,2,0,0);
|
||||
|
@ -1726,14 +1728,14 @@ void renderExplosionEffect(EFFECT *psEffect)
|
|||
/* Tesla explosions diminish in size */
|
||||
if(psEffect->type == EXPLOSION_TYPE_TESLA)
|
||||
{
|
||||
percent = MAKEINT(PERCENT((gameTime - psEffect->birthTime),psEffect->lifeSpan));
|
||||
percent = PERCENT((gameTime - psEffect->birthTime),psEffect->lifeSpan);
|
||||
if(percent<0) percent = 0;
|
||||
if(percent>45) percent = 45;
|
||||
pie_MatScale(psEffect->size - percent);
|
||||
}
|
||||
else if(psEffect->type == EXPLOSION_TYPE_PLASMA)
|
||||
{
|
||||
percent = (MAKEINT(PERCENT((gameTime - psEffect->birthTime),psEffect->lifeSpan)))/3;
|
||||
percent = PERCENT(gameTime - psEffect->birthTime, psEffect->lifeSpan) / 3;
|
||||
pie_MatScale(BASE_PLASMA_SIZE + percent);
|
||||
}
|
||||
else
|
||||
|
@ -1808,7 +1810,7 @@ void renderConstructionEffect(EFFECT *psEffect)
|
|||
}
|
||||
|
||||
/* Scale size according to age */
|
||||
percent = MAKEINT(PERCENT((gameTime - psEffect->birthTime),psEffect->lifeSpan));
|
||||
percent = PERCENT(gameTime - psEffect->birthTime, psEffect->lifeSpan);
|
||||
if(percent<0) percent = 0;
|
||||
if(percent>100) percent = 100;
|
||||
|
||||
|
@ -2640,25 +2642,27 @@ UDWORD i;
|
|||
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
BOOL fireOnLocation(UDWORD x, UDWORD y)
|
||||
bool fireOnLocation(unsigned int x, unsigned int y)
|
||||
{
|
||||
UDWORD i;
|
||||
UDWORD posX,posY;
|
||||
BOOL bOnFire;
|
||||
unsigned int i;
|
||||
|
||||
for(i=0, bOnFire = FALSE; i<MAX_EFFECTS && !bOnFire; i++)
|
||||
for(i = 0; i < MAX_EFFECTS; ++i)
|
||||
{
|
||||
if( (effectStatus[i] == ES_ACTIVE) && asEffectsList[i].group == EFFECT_FIRE)
|
||||
if (effectStatus[i] == ES_ACTIVE
|
||||
&& asEffectsList[i].group == EFFECT_FIRE)
|
||||
{
|
||||
posX = MAKEINT(asEffectsList[i].position.x);
|
||||
posY = MAKEINT(asEffectsList[i].position.z);
|
||||
if( (posX == x) && (posY == y) )
|
||||
const unsigned int posX = asEffectsList[i].position.x;
|
||||
const unsigned int posY = asEffectsList[i].position.z;
|
||||
|
||||
if (posX == x
|
||||
&& posY == y)
|
||||
{
|
||||
bOnFire = TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(bOnFire);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Write the given EFFECT to the given file with endianness swapped correctly
|
||||
|
|
|
@ -235,7 +235,7 @@ extern UDWORD getMissCount( void );
|
|||
extern UDWORD getNumSkippedEffects(void);
|
||||
extern UDWORD getNumEvenEffects(void);
|
||||
|
||||
extern BOOL fireOnLocation(UDWORD x, UDWORD y);
|
||||
extern bool fireOnLocation(unsigned int x, unsigned int y);
|
||||
|
||||
extern UDWORD EffectGetNumFrames(EFFECT *psEffect);
|
||||
extern UDWORD IMDGetNumFrames(iIMDShape *Shape);
|
||||
|
|
|
@ -118,14 +118,13 @@ MAPTILE *psTile;
|
|||
}
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
UDWORD environGetValue( UDWORD x, UDWORD y )
|
||||
unsigned int environGetValue(unsigned int x, unsigned int y)
|
||||
{
|
||||
SDWORD retVal;
|
||||
|
||||
retVal = MAKEINT(pEnvironData[(y*mapWidth) + x].val);
|
||||
if(retVal<0) retVal = 0;
|
||||
return(retVal);
|
||||
int retVal = pEnvironData[(y * mapWidth) + x].val;
|
||||
if (retVal < 0)
|
||||
retVal = 0;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
// -------------------------------------------------------------------------------
|
||||
extern BOOL environInit ( void );
|
||||
extern UDWORD environGetValue ( UDWORD x, UDWORD y );
|
||||
extern unsigned int environGetValue (unsigned int x, unsigned int y);
|
||||
extern UDWORD environGetData ( UDWORD x, UDWORD y );
|
||||
extern void environShutDown ( void );
|
||||
//this function is called whenever the map changes - load new level or return from an offWorld map
|
||||
|
|
|
@ -351,23 +351,21 @@ void formationReset(FORMATION *psFormation)
|
|||
static void formationCalcPos(FORMATION *psFormation, SDWORD line, SDWORD dist,
|
||||
SDWORD *pX, SDWORD *pY)
|
||||
{
|
||||
SDWORD dir, xoffset,yoffset, rank;
|
||||
|
||||
rank = dist / psFormation->size;
|
||||
const int rank = dist / psFormation->size;
|
||||
|
||||
// calculate the offset of the line based on the rank
|
||||
dir = (SDWORD)adjustDirection(psFormation->dir, 180);
|
||||
xoffset = MAKEINT(trigSin(dir) * (float)(psFormation->rankDist * rank))
|
||||
int dir = adjustDirection(psFormation->dir, 180);
|
||||
const int xoffset = (int)(trigSin(dir) * (float)(psFormation->rankDist * rank))
|
||||
+ psFormation->asLines[line].xoffset;
|
||||
yoffset = MAKEINT(trigCos(dir) * (float)(psFormation->rankDist * rank))
|
||||
const int yoffset = (int)(trigCos(dir) * (float)(psFormation->rankDist * rank))
|
||||
+ psFormation->asLines[line].yoffset;
|
||||
|
||||
// calculate the position of the gap
|
||||
dir = psFormation->asLines[line].dir;
|
||||
dist -= psFormation->size * rank;
|
||||
*pX = MAKEINT(trigSin(dir) * (float)dist)
|
||||
*pX = (int)(trigSin(dir) * (float)dist)
|
||||
+ xoffset + psFormation->x;
|
||||
*pY = MAKEINT(trigCos(dir) * (float)dist)
|
||||
*pY = (int)(trigCos(dir) * (float)dist)
|
||||
+ yoffset + psFormation->y;
|
||||
}
|
||||
|
||||
|
|
|
@ -598,8 +598,8 @@ void kf_ZoomOut( void )
|
|||
{
|
||||
float fraction = (float)frameTime2 / (float)GAME_TICKS_PER_SEC;
|
||||
float zoomInterval = fraction * (float)MAP_ZOOM_RATE;
|
||||
distance += MAKEINT(zoomInterval);
|
||||
if(distance>MAXDISTANCE)
|
||||
distance += zoomInterval;
|
||||
if(distance > MAXDISTANCE)
|
||||
{
|
||||
distance = MAXDISTANCE;
|
||||
}
|
||||
|
@ -642,9 +642,9 @@ void kf_ZoomIn( void )
|
|||
{
|
||||
float fraction = (float)frameTime2 / (float)GAME_TICKS_PER_SEC;
|
||||
float zoomInterval = fraction * (float)MAP_ZOOM_RATE;
|
||||
distance -= MAKEINT(zoomInterval);
|
||||
distance -= zoomInterval;
|
||||
|
||||
if( distance< MINDISTANCE)
|
||||
if (distance < MINDISTANCE)
|
||||
{
|
||||
distance = MINDISTANCE;
|
||||
}
|
||||
|
@ -702,7 +702,7 @@ void kf_RotateLeft( void )
|
|||
{
|
||||
float fraction = (float)frameTime2 / (float)GAME_TICKS_PER_SEC;
|
||||
float rotAmount = fraction * (float)MAP_SPIN_RATE;
|
||||
player.r.y += MAKEINT(rotAmount);
|
||||
player.r.y += rotAmount;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
@ -711,8 +711,8 @@ void kf_RotateRight( void )
|
|||
{
|
||||
float fraction = (float)frameTime2 / (float)GAME_TICKS_PER_SEC;
|
||||
float rotAmount = fraction * (float)MAP_SPIN_RATE;
|
||||
player.r.y -= MAKEINT(rotAmount);
|
||||
if(player.r.y < 0)
|
||||
player.r.y -= rotAmount;
|
||||
if (player.r.y < 0)
|
||||
{
|
||||
player.r.y += DEG(360);
|
||||
}
|
||||
|
@ -738,7 +738,7 @@ void kf_PitchBack( void )
|
|||
// {
|
||||
//#endif
|
||||
|
||||
player.r.x+= MAKEINT(pitchAmount);
|
||||
player.r.x += pitchAmount;
|
||||
|
||||
//#ifdef ALEXM
|
||||
// }
|
||||
|
@ -762,17 +762,17 @@ void kf_PitchForward( void )
|
|||
{
|
||||
float fraction = (float)frameTime2 / (float)GAME_TICKS_PER_SEC;
|
||||
float pitchAmount = fraction * (float)MAP_PITCH_RATE;
|
||||
player.r.x -= MAKEINT(pitchAmount);
|
||||
player.r.x -= pitchAmount;
|
||||
//#ifdef ALEXM
|
||||
// if(getDebugMappingStatus() == FALSE)
|
||||
//#endif
|
||||
// {
|
||||
if(player.r.x <DEG(360+MIN_PLAYER_X_ANGLE))
|
||||
if (player.r.x < DEG(360 + MIN_PLAYER_X_ANGLE))
|
||||
{
|
||||
player.r.x = DEG(360+MIN_PLAYER_X_ANGLE);
|
||||
player.r.x = DEG(360 + MIN_PLAYER_X_ANGLE);
|
||||
}
|
||||
// }
|
||||
setDesiredPitch(player.r.x/DEG_1);
|
||||
setDesiredPitch(player.r.x / DEG_1);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
@ -1082,7 +1082,7 @@ if(bMultiPlayer && (NetPlay.bComms != 0) )
|
|||
else
|
||||
{
|
||||
godMode = TRUE;
|
||||
// setModifiers(FRACTCONST(1000,100),FRACTCONST(100,1000));
|
||||
// setModifiers(1000.f / 100.f,100.f / 1000.f);
|
||||
CONPRINTF(ConsoleString,(ConsoleString,"God Mode ON"));
|
||||
}
|
||||
|
||||
|
@ -1118,13 +1118,13 @@ void kf_TogglePauseMode( void )
|
|||
setConsolePause(TRUE);
|
||||
setScriptPause(TRUE);
|
||||
setAudioPause(TRUE);
|
||||
|
||||
|
||||
// If cursor trapping is enabled allow the cursor to leave the window
|
||||
if (war_GetTrapCursor())
|
||||
{
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
}
|
||||
|
||||
|
||||
/* And stop the clock */
|
||||
gameTimeStop();
|
||||
addConsoleMessage(_("PAUSED"),CENTRE_JUSTIFY);
|
||||
|
@ -1137,13 +1137,13 @@ void kf_TogglePauseMode( void )
|
|||
setConsolePause(FALSE);
|
||||
setScriptPause(FALSE);
|
||||
setAudioPause(FALSE);
|
||||
|
||||
|
||||
// Re-enable cursor trapping if it is enabled
|
||||
if (war_GetTrapCursor())
|
||||
{
|
||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
}
|
||||
|
||||
|
||||
/* And start the clock again */
|
||||
gameTimeStart();
|
||||
}
|
||||
|
@ -2256,17 +2256,17 @@ void kf_ToggleShadows( void )
|
|||
// --------------------------------------------------------------------------
|
||||
|
||||
float available_speed[] = {
|
||||
FRACTCONST(1, 8),
|
||||
FRACTCONST(1, 4),
|
||||
FRACTCONST(1, 2),
|
||||
FRACTCONST(3, 4),
|
||||
FRACTCONST(1, 1),
|
||||
FRACTCONST(3, 2),
|
||||
FRACTCONST(2, 1),
|
||||
FRACTCONST(5, 2),
|
||||
FRACTCONST(3, 1),
|
||||
FRACTCONST(10, 1),
|
||||
FRACTCONST(20, 1)
|
||||
1.f / 8.f,
|
||||
1.f / 4.f,
|
||||
1.f / 2.f,
|
||||
3.f / 4.f,
|
||||
1.f / 1.f,
|
||||
3.f / 2.f,
|
||||
2.f / 1.f,
|
||||
5.f / 2.f,
|
||||
3.f / 1.f,
|
||||
10.f / 1.f,
|
||||
20.f / 1.f
|
||||
};
|
||||
unsigned int nb_available_speeds = 11;
|
||||
|
||||
|
@ -2285,7 +2285,7 @@ void kf_SpeedUp( void )
|
|||
if (mod < available_speed[i]) {
|
||||
mod = available_speed[i];
|
||||
|
||||
if (mod == FRACTCONST(1, 1)) {
|
||||
if (mod == 1.f / 1.f) {
|
||||
CONPRINTF(ConsoleString,(ConsoleString,_("Game Speed Reset")));
|
||||
} else {
|
||||
CONPRINTF(ConsoleString,(ConsoleString,_("Game Speed Increased to %3.1f"),mod));
|
||||
|
@ -2312,7 +2312,7 @@ void kf_SlowDown( void )
|
|||
if (mod > available_speed[i]) {
|
||||
mod = available_speed[i];
|
||||
|
||||
if (mod == FRACTCONST(1, 1)) {
|
||||
if (mod == 1.f / 1.f) {
|
||||
CONPRINTF(ConsoleString,(ConsoleString,_("Game Speed Reset")));
|
||||
} else {
|
||||
CONPRINTF(ConsoleString,(ConsoleString,_("Game Speed Reduced to %3.1f"),mod));
|
||||
|
|
|
@ -509,7 +509,7 @@ float fraction,adjust;
|
|||
presVal = psDroid->illumination;
|
||||
adjust = (float)lightVal - (float)presVal;
|
||||
adjust *= (fraction*DROID_SEEK_LIGHT_SPEED) ;
|
||||
retVal = presVal + MAKEINT(adjust);
|
||||
retVal = presVal + adjust;
|
||||
if(retVal > 255) retVal = 255;
|
||||
psDroid->illumination = (UBYTE)retVal;
|
||||
}
|
||||
|
|
|
@ -805,7 +805,7 @@ void missionFlyTransportersIn( SDWORD iPlayer, BOOL bTrackTransporter )
|
|||
DROID *psTransporter, *psNext;
|
||||
UWORD iX, iY, iZ;
|
||||
SDWORD iLandX, iLandY, iDx, iDy;
|
||||
FRACT_D fR;
|
||||
double fR;
|
||||
|
||||
bTrackingTransporter = bTrackTransporter;
|
||||
|
||||
|
@ -842,10 +842,10 @@ void missionFlyTransportersIn( SDWORD iPlayer, BOOL bTrackTransporter )
|
|||
iDy = iLandY - iY;
|
||||
|
||||
|
||||
fR = (FRACT_D) atan2(iDx, iDy);
|
||||
fR = (double) atan2(iDx, iDy);
|
||||
if ( fR < 0.0 )
|
||||
{
|
||||
fR += (FRACT_D) (2 * M_PI);
|
||||
fR += (double) (2 * M_PI);
|
||||
}
|
||||
psTransporter->direction = RAD_TO_DEG(fR);
|
||||
|
||||
|
@ -4096,7 +4096,7 @@ void missionDestroyObjects(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// human player, check that we do not reference the cleared out data
|
||||
Player = selectedPlayer;
|
||||
|
||||
|
|
70
src/move.c
70
src/move.c
|
@ -116,10 +116,10 @@
|
|||
#define BLOCK_DIR 90
|
||||
// The min and max ratios of target/obstruction distances for an obstruction
|
||||
// to be on the target
|
||||
#define BLOCK_MINRATIO FRACTCONST(99,100)
|
||||
#define BLOCK_MAXRATIO FRACTCONST(101,100)
|
||||
#define BLOCK_MINRATIO 99.f / 100.f
|
||||
#define BLOCK_MAXRATIO 101.f / 100.f
|
||||
// The result of the dot product for two vectors to be the same direction
|
||||
#define BLOCK_DOTVAL FRACTCONST(99,100)
|
||||
#define BLOCK_DOTVAL 99.f / 100.f
|
||||
|
||||
// How far out from an obstruction to start avoiding it
|
||||
#define AVOID_DIST (TILE_UNITS*2)
|
||||
|
@ -131,13 +131,13 @@
|
|||
#define BASE_TURN 1
|
||||
|
||||
/* What the base speed is intialised to */
|
||||
#define BASE_SPEED_INIT FRACTCONST(BASE_SPEED, BASE_DEF_RATE)
|
||||
#define BASE_SPEED_INIT ((float)BASE_SPEED / (float)BASE_DEF_RATE)
|
||||
|
||||
/* What the frame rate is assumed to be at start up */
|
||||
#define BASE_DEF_RATE 25
|
||||
|
||||
/* What the base turn rate is intialised to */
|
||||
#define BASE_TURN_INIT FRACTCONST(BASE_TURN, BASE_DEF_RATE)
|
||||
#define BASE_TURN_INIT ((float)BASE_TURN / (float)BASE_DEF_RATE)
|
||||
|
||||
// maximum and minimum speed to approach a final way point
|
||||
#define MAX_END_SPEED 300
|
||||
|
@ -392,8 +392,8 @@ static BOOL moveDroidToBase(DROID *psDroid, UDWORD x, UDWORD y, BOOL bFormation)
|
|||
/* check formations */
|
||||
if ( retVal == FPR_OK )
|
||||
{
|
||||
debug( LOG_MOVEMENT, "unit(%d): base Speed %d, speed %d\n",
|
||||
psDroid->id, psDroid->baseSpeed, MAKEINT(psDroid->sMove.speed));
|
||||
debug( LOG_MOVEMENT, "unit(%u): base Speed %u, speed %f\n",
|
||||
psDroid->id, psDroid->baseSpeed, psDroid->sMove.speed);
|
||||
|
||||
// bit of a hack this - john
|
||||
// if astar doesn't have a complete route, it returns a route to the nearest clear tile.
|
||||
|
@ -1071,8 +1071,8 @@ static void moveCheckSquished(DROID *psDroid, float mx,float my)
|
|||
rad = droidR + objR;
|
||||
radSq = rad*rad;
|
||||
|
||||
xdiff = (SDWORD)psDroid->pos.x + MAKEINT(mx) - (SDWORD)psInfo->psObj->pos.x;
|
||||
ydiff = (SDWORD)psDroid->pos.y + MAKEINT(my) - (SDWORD)psInfo->psObj->pos.y;
|
||||
xdiff = (SDWORD)psDroid->pos.x + mx - psInfo->psObj->pos.x;
|
||||
ydiff = (SDWORD)psDroid->pos.y + my - psInfo->psObj->pos.y;
|
||||
distSq = xdiff*xdiff + ydiff*ydiff;
|
||||
|
||||
if (((2*radSq)/3) > distSq)
|
||||
|
@ -1468,14 +1468,14 @@ static void moveCalcBlockingSlide(DROID *psDroid, float *pmx, float *pmy, SDWORD
|
|||
{
|
||||
// on a blocking tile - see if we need to jump off
|
||||
|
||||
intx = MAKEINT(psDroid->sMove.fx) & TILE_MASK;
|
||||
inty = MAKEINT(psDroid->sMove.fy) & TILE_MASK;
|
||||
jumpx = (SDWORD)psDroid->pos.x;
|
||||
jumpy = (SDWORD)psDroid->pos.y;
|
||||
intx = (int)psDroid->sMove.fx & TILE_MASK;
|
||||
inty = (int)psDroid->sMove.fy & TILE_MASK;
|
||||
jumpx = psDroid->pos.x;
|
||||
jumpy = psDroid->pos.y;
|
||||
bJumped = FALSE;
|
||||
|
||||
/* jumpx = MAKEINT(nx - mx);
|
||||
jumpy = MAKEINT(ny - my);
|
||||
/* jumpx = nx - mx;
|
||||
jumpy = ny - my;
|
||||
intx = jumpx & TILE_MASK;
|
||||
inty = jumpy & TILE_MASK;
|
||||
bJumped = FALSE;*/
|
||||
|
@ -1663,9 +1663,9 @@ static void moveCalcDroidSlide(DROID *psDroid, float *pmx, float *pmy)
|
|||
rad = droidR + objR;
|
||||
radSq = rad*rad;
|
||||
|
||||
xdiff = MAKEINT(psDroid->sMove.fx + *pmx) - (SDWORD)psInfo->psObj->pos.x;
|
||||
ydiff = MAKEINT(psDroid->sMove.fy + *pmy) - (SDWORD)psInfo->psObj->pos.y;
|
||||
distSq = xdiff*xdiff + ydiff*ydiff;
|
||||
xdiff = psDroid->sMove.fx + *pmx - psInfo->psObj->pos.x;
|
||||
ydiff = psDroid->sMove.fy + *pmy - psInfo->psObj->pos.y;
|
||||
distSq = xdiff * xdiff + ydiff * ydiff;
|
||||
if ((float)xdiff * *pmx + (float)ydiff * *pmy >= 0)
|
||||
{
|
||||
// object behind
|
||||
|
@ -2405,8 +2405,8 @@ static void moveUpdateDroidPos( DROID *psDroid, float dx, float dy )
|
|||
psDroid->sMove.fx += dx;
|
||||
psDroid->sMove.fy += dy;
|
||||
|
||||
iX = MAKEINT(psDroid->sMove.fx);
|
||||
iY = MAKEINT(psDroid->sMove.fy);
|
||||
iX = psDroid->sMove.fx;
|
||||
iY = psDroid->sMove.fy;
|
||||
|
||||
/* impact if about to go off map else update coordinates */
|
||||
if ( worldOnMap( iX, iY ) == FALSE )
|
||||
|
@ -2456,27 +2456,27 @@ 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 float hvrTurn = FRACTCONST(3,4); //0.75f;
|
||||
static float whlTurn = FRACTCONST(1,1); //1.0f;
|
||||
static float trkTurn = FRACTCONST(1,1); //1.0f;
|
||||
static float hvrTurn = 3.f / 4.f; //0.75f;
|
||||
static float whlTurn = 1.f / 1.f; //1.0f;
|
||||
static float trkTurn = 1.f / 1.f; //1.0f;
|
||||
|
||||
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
|
||||
switch (psPropStats->propulsionType)
|
||||
{
|
||||
case HOVER:
|
||||
spinSpeed = MAKEINT(psDroid->baseSpeed*hvrTurn);
|
||||
turnSpeed = MAKEINT(psDroid->baseSpeed/3*hvrTurn);
|
||||
spinSpeed = psDroid->baseSpeed * hvrTurn;
|
||||
turnSpeed = psDroid->baseSpeed / 3 * hvrTurn;
|
||||
skidDecel = hvrSkid;//HOVER_SKID_DECEL;
|
||||
break;
|
||||
case WHEELED:
|
||||
spinSpeed = MAKEINT(psDroid->baseSpeed*hvrTurn);
|
||||
turnSpeed = MAKEINT(psDroid->baseSpeed/3*whlTurn);
|
||||
spinSpeed = psDroid->baseSpeed * hvrTurn;
|
||||
turnSpeed = psDroid->baseSpeed / 3 * whlTurn;
|
||||
skidDecel = whlSkid;//WHEELED_SKID_DECEL;
|
||||
break;
|
||||
case TRACKED:
|
||||
default:
|
||||
spinSpeed = MAKEINT(psDroid->baseSpeed*hvrTurn);
|
||||
turnSpeed = MAKEINT(psDroid->baseSpeed/3*trkTurn);
|
||||
spinSpeed = psDroid->baseSpeed * hvrTurn;
|
||||
turnSpeed = psDroid->baseSpeed / 3 * trkTurn;
|
||||
skidDecel = trkSkid;//TRACKED_SKID_DECEL;
|
||||
break;
|
||||
}
|
||||
|
@ -2957,10 +2957,10 @@ moveUpdateCyborgModel( DROID *psDroid, SDWORD moveSpeed, SDWORD moveDir, UBYTE o
|
|||
}
|
||||
|
||||
/* calculate move distance */
|
||||
iDx = (SDWORD) psDroid->sMove.DestinationX - (SDWORD) psDroid->pos.x;
|
||||
iDy = (SDWORD) psDroid->sMove.DestinationY - (SDWORD) psDroid->pos.y;
|
||||
iDz = (SDWORD) psDroid->pos.z - (SDWORD) iMapZ;
|
||||
iDist = MAKEINT( trigIntSqrt( iDx*iDx + iDy*iDy ) );
|
||||
iDx = psDroid->sMove.DestinationX - psDroid->pos.x;
|
||||
iDy = psDroid->sMove.DestinationY - psDroid->pos.y;
|
||||
iDz = psDroid->pos.z - iMapZ;
|
||||
iDist = trigIntSqrt(iDx * iDx + iDy * iDy);
|
||||
|
||||
/* set jumping cyborg walking short distances */
|
||||
if ( (psPropStats->propulsionType != JUMP) ||
|
||||
|
@ -3637,7 +3637,7 @@ void moveUpdateDroid(DROID *psDroid)
|
|||
/* moveGetDirection(psDroid, &tx,&ty);
|
||||
tangle = vectorToAngle(tx,ty);
|
||||
moveSpeed = moveCalcDroidSpeed(psDroid);
|
||||
moveDir = MAKEINT(tangle);*/
|
||||
moveDir = tangle;*/
|
||||
|
||||
/* descend if no orders or actions or cyborg at target */
|
||||
/* if ( (psDroid->droidType == DROID_CYBORG) ||
|
||||
|
@ -3677,7 +3677,7 @@ void moveUpdateDroid(DROID *psDroid)
|
|||
// Driven around by the player.
|
||||
case MOVEDRIVE:
|
||||
driveSetDroidMove(psDroid);
|
||||
moveSpeed = driveGetMoveSpeed(); //MAKEINT(psDroid->sMove.speed);
|
||||
moveSpeed = driveGetMoveSpeed(); //psDroid->sMove.speed;
|
||||
moveDir = driveGetMoveDir(); //psDroid->sMove.dir;
|
||||
ASSERT(moveDir >= 0 && moveDir <= 360, "Illegal movement direction");
|
||||
break;
|
||||
|
|
|
@ -180,7 +180,7 @@ BOOL multiplayerWinSequence(BOOL firstCall)
|
|||
{
|
||||
fraction = (float)frameTime / (float)GAME_TICKS_PER_SEC;
|
||||
rotAmount = fraction * MAP_SPIN_RATE / 12;
|
||||
player.r.y += MAKEINT(rotAmount);
|
||||
player.r.y += rotAmount;
|
||||
}
|
||||
|
||||
if(last > gameTime)last= 0;
|
||||
|
@ -624,7 +624,7 @@ BOOL recvMessage(void)
|
|||
{
|
||||
// Cocpy the message to the global one used by the new NET API
|
||||
NetMsg = msg;
|
||||
|
||||
|
||||
// messages only in game.
|
||||
if(!ingame.localJoiningInProgress)
|
||||
{
|
||||
|
|
|
@ -66,27 +66,22 @@ UDWORD getStepIndexFromAngle(UDWORD angle);
|
|||
of course ambiguous in the case where the two given angles
|
||||
are 180 degrees apart
|
||||
*/
|
||||
UDWORD getBisectingDirectionAway(UDWORD angleA,UDWORD angleB)
|
||||
unsigned int getBisectingDirectionAway(unsigned int angleA, unsigned int angleB)
|
||||
{
|
||||
float xVec,yVec;
|
||||
float angle;
|
||||
UDWORD retVal;
|
||||
|
||||
/* Get the component vectors */
|
||||
xVec = trigSin(angleA) + trigSin(angleB);
|
||||
yVec = trigCos(angleA) + trigCos(angleB);
|
||||
const float xVec = trigSin(angleA) + trigSin(angleB);
|
||||
const float yVec = trigCos(angleA) + trigCos(angleB);
|
||||
|
||||
/* Get the angle between them */
|
||||
angle = RAD_TO_DEG(atan2(xVec,yVec));
|
||||
angle+=360;
|
||||
const float angle = RAD_TO_DEG(atan2(xVec, yVec)) + 360.f;
|
||||
/* Get it as an integer */
|
||||
retVal = (MAKEINT(angle))%360;
|
||||
unsigned int retVal = fmodf(angle, 360.f);
|
||||
|
||||
/* And make it point the other way - into larger arc */
|
||||
retVal = (retVal + 180)%360;
|
||||
ASSERT( retVal<360,"Weird angle found" );
|
||||
retVal = (retVal + 180) % 360;
|
||||
ASSERT(retVal < 360, "Out of bounds angle found: %u", retVal);
|
||||
|
||||
return(retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
#ifndef _optimisepath_h
|
||||
#define _optimisepath_h
|
||||
|
||||
extern UDWORD getBisectingDirectionAway ( UDWORD angleA,UDWORD angleB );
|
||||
|
||||
extern unsigned int getBisectingDirectionAway(unsigned int angleA, unsigned int angleB);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -252,10 +252,10 @@ static float QualityFactor(DROID *psAttacker, DROID *psVictim)
|
|||
{
|
||||
float powerRatio = calcDroidPower(psVictim) / calcDroidPower(psAttacker);
|
||||
float pointsRatio = calcDroidPoints(psVictim) / calcDroidPoints(psAttacker);
|
||||
|
||||
|
||||
CLIP(powerRatio, 0.5, 2.0);
|
||||
CLIP(pointsRatio, 0.5, 2.0);
|
||||
|
||||
|
||||
return (powerRatio + pointsRatio) / 2;
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ static void proj_UpdateKills(PROJECTILE *psObj, float experienceInc)
|
|||
if (psObj->psSource->type == OBJ_DROID) /* update droid kills */
|
||||
{
|
||||
psDroid = (DROID *) psObj->psSource;
|
||||
|
||||
|
||||
// If it is 'droid-on-droid' then modify the experience by the Quality factor
|
||||
// Only do this in MP so to not un-balance the campaign
|
||||
if (psObj->psDest != NULL
|
||||
|
@ -297,9 +297,9 @@ static void proj_UpdateKills(PROJECTILE *psObj, float experienceInc)
|
|||
experienceInc *= QualityFactor(psDroid, (DROID *) psObj->psDest);
|
||||
}
|
||||
|
||||
psDroid->experience += experienceInc;
|
||||
psDroid->experience += experienceInc;
|
||||
cmdDroidUpdateKills(psDroid, experienceInc);
|
||||
|
||||
|
||||
if (orderStateObj(psDroid, DORDER_FIRESUPPORT, &psSensor)
|
||||
&& psSensor->type == OBJ_DROID)
|
||||
{
|
||||
|
@ -310,7 +310,7 @@ static void proj_UpdateKills(PROJECTILE *psObj, float experienceInc)
|
|||
{
|
||||
// See if there was a command droid designating this target
|
||||
psDroid = cmdDroidGetDesignator(psObj->psSource->player);
|
||||
|
||||
|
||||
if (psDroid != NULL
|
||||
&& psDroid->action == DACTION_ATTACK
|
||||
&& psDroid->psActionTarget[0] == psObj->psDest)
|
||||
|
@ -329,7 +329,7 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
|
|||
PROJECTILE *psObj = malloc(sizeof(PROJECTILE));
|
||||
SDWORD tarHeight, srcHeight, iMinSq;
|
||||
SDWORD altChange, dx, dy, dz, iVelSq, iVel;
|
||||
FRACT_D fR, fA, fS, fT, fC;
|
||||
double fR, fA, fS, fT, fC;
|
||||
Vector3i muzzle;
|
||||
SDWORD iRadSq, iPitchLow, iPitchHigh, iTemp;
|
||||
UDWORD heightVariance;
|
||||
|
@ -474,10 +474,10 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
|
|||
/* roll never set */
|
||||
psObj->roll = 0;
|
||||
|
||||
fR = (FRACT_D) atan2(dx, dy);
|
||||
fR = (double) atan2(dx, dy);
|
||||
if ( fR < 0.0 )
|
||||
{
|
||||
fR += (FRACT_D) (2 * M_PI);
|
||||
fR += (double) (2 * M_PI);
|
||||
}
|
||||
psObj->direction = RAD_TO_DEG(fR);
|
||||
|
||||
|
@ -490,10 +490,10 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
|
|||
if ( proj_Direct(psObj->psWStats) ||
|
||||
( !proj_Direct(psWeapStats) && (iRadSq <= iMinSq) ) )
|
||||
{
|
||||
fR = (FRACT_D) atan2(dz, fR);
|
||||
fR = (double) atan2(dz, fR);
|
||||
if ( fR < 0.0 )
|
||||
{
|
||||
fR += (FRACT_D) (2 * M_PI);
|
||||
fR += (double) (2 * M_PI);
|
||||
}
|
||||
psObj->pitch = (SWORD)( RAD_TO_DEG(fR) );
|
||||
psObj->pInFlightFunc = proj_InFlightDirectFunc;
|
||||
|
@ -503,25 +503,24 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
|
|||
/* indirect */
|
||||
iVelSq = psObj->psWStats->flightSpeed * psObj->psWStats->flightSpeed;
|
||||
|
||||
fA = ACC_GRAVITY*MAKEFRACT_D(iRadSq) / (2*iVelSq);
|
||||
fC = 4 * fA * (MAKEFRACT_D(dz) + fA);
|
||||
fS = MAKEFRACT_D(iRadSq) - fC;
|
||||
fA = ACC_GRAVITY * (double)iRadSq / (2 * iVelSq);
|
||||
fC = 4 * fA * ((double)dz + fA);
|
||||
fS = (double)iRadSq - fC;
|
||||
|
||||
/* target out of range - increase velocity to hit target */
|
||||
if ( fS < MAKEFRACT_D(0) )
|
||||
if ( fS < 0. )
|
||||
{
|
||||
/* set optimal pitch */
|
||||
psObj->pitch = PROJ_MAX_PITCH;
|
||||
|
||||
fS = (FRACT_D)trigSin(PROJ_MAX_PITCH);
|
||||
fC = (FRACT_D)trigCos(PROJ_MAX_PITCH);
|
||||
fT = FRACTdiv_D( fS, fC );
|
||||
fS = ACC_GRAVITY*(MAKEFRACT_D(1)+FRACTmul_D(fT,fT));
|
||||
fS = FRACTdiv_D(fS,(2 * (FRACTmul_D(fR,fT) - MAKEFRACT_D(dz))));
|
||||
fS = (double)trigSin(PROJ_MAX_PITCH);
|
||||
fC = (double)trigCos(PROJ_MAX_PITCH);
|
||||
fT = fS / fC;
|
||||
fS = ACC_GRAVITY * (1. + fT * fT);
|
||||
fS = fS / (2 * (fR * fT - (double)dz));
|
||||
{
|
||||
FRACT_D Tmp;
|
||||
Tmp = FRACTmul_D(fR,fR);
|
||||
iVel = MAKEINT_D( trigIntSqrt(MAKEINT_D(FRACTmul_D(fS,Tmp))) );
|
||||
double Tmp = fR * fR;
|
||||
iVel = trigIntSqrt(fS * Tmp);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -530,24 +529,24 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
|
|||
iVel = psObj->psWStats->flightSpeed;
|
||||
|
||||
/* get floating point square root */
|
||||
fS = trigIntSqrt( MAKEINT_D(fS) );
|
||||
fS = trigIntSqrt(fS);
|
||||
|
||||
fT = (FRACT_D) atan2(fR+fS, 2*fA);
|
||||
fT = (double) atan2(fR + fS, 2 * fA);
|
||||
|
||||
/* make sure angle positive */
|
||||
if ( fT < 0 )
|
||||
{
|
||||
fT += (FRACT_D) (2 * M_PI);
|
||||
fT += (double) (2 * M_PI);
|
||||
}
|
||||
iPitchLow = MAKEINT_D(RAD_TO_DEG(fT));
|
||||
iPitchLow = RAD_TO_DEG(fT);
|
||||
|
||||
fT = (FRACT_D) atan2(fR-fS, 2*fA);
|
||||
fT = (double) atan2(fR-fS, 2*fA);
|
||||
/* make sure angle positive */
|
||||
if ( fT < 0 )
|
||||
{
|
||||
fT += (FRACT_D) (2 * M_PI);
|
||||
fT += (double) (2 * M_PI);
|
||||
}
|
||||
iPitchHigh = MAKEINT_D(RAD_TO_DEG(fT));
|
||||
iPitchHigh = RAD_TO_DEG(fT);
|
||||
|
||||
/* swap pitches if wrong way round */
|
||||
if ( iPitchLow > iPitchHigh )
|
||||
|
@ -582,8 +581,8 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
|
|||
}
|
||||
}
|
||||
|
||||
psObj->vXY = MAKEINT_D(iVel * trigCos(psObj->pitch));
|
||||
psObj->vZ = MAKEINT_D(iVel * trigSin(psObj->pitch));
|
||||
psObj->vXY = iVel * trigCos(psObj->pitch);
|
||||
psObj->vZ = iVel * trigSin(psObj->pitch);
|
||||
|
||||
/* set function pointer */
|
||||
psObj->pInFlightFunc = proj_InFlightIndirectFunc;
|
||||
|
|
|
@ -97,36 +97,36 @@ BOOL rayInitialise(void)
|
|||
}
|
||||
|
||||
// These are used to calculate the initial intersection
|
||||
rayFPTan[i] = MAKEINT(val * (float)RAY_ACCMUL);
|
||||
rayFPInvTan[i] = MAKEINT((float)RAY_ACCMUL / val);
|
||||
rayFPTan[i] = val * (float)RAY_ACCMUL;
|
||||
rayFPInvTan[i] = (float)RAY_ACCMUL / val;
|
||||
|
||||
// Set up the trig tables for calculating the offset distances
|
||||
val = (float)sin(angle);
|
||||
if(val == 0) {
|
||||
val = (float)1;
|
||||
}
|
||||
rayFPInvSin[i] = MAKEINT((float)RAY_ACCMUL / val);
|
||||
rayFPInvSin[i] = (float)RAY_ACCMUL / val;
|
||||
if (i >= NUM_RAYS/2)
|
||||
{
|
||||
rayVDist[i] = MAKEINT((float)-TILE_UNITS / val);
|
||||
rayVDist[i] = (float) - TILE_UNITS / val;
|
||||
}
|
||||
else
|
||||
{
|
||||
rayVDist[i] = MAKEINT((float)TILE_UNITS / val);
|
||||
rayVDist[i] = (float)TILE_UNITS / val;
|
||||
}
|
||||
|
||||
val = (float)cos(angle);
|
||||
if(val == 0) {
|
||||
val = (float)1;
|
||||
}
|
||||
rayFPInvCos[i] = MAKEINT((float)RAY_ACCMUL / val);
|
||||
rayFPInvCos[i] = (float)RAY_ACCMUL / val;
|
||||
if (i < NUM_RAYS/4 || i > 3*NUM_RAYS/4)
|
||||
{
|
||||
rayHDist[i] = MAKEINT((float)TILE_UNITS / val);
|
||||
rayHDist[i] = (float)TILE_UNITS / val;
|
||||
}
|
||||
else
|
||||
{
|
||||
rayHDist[i] = MAKEINT((float)-TILE_UNITS / val);
|
||||
rayHDist[i] = (float)-TILE_UNITS / val;
|
||||
}
|
||||
|
||||
angle += RAY_ANGLE;
|
||||
|
@ -584,7 +584,7 @@ void getBestPitchToEdgeOfGrid(UDWORD x, UDWORD y, UDWORD direction, SDWORD *pitc
|
|||
//DBPRINTF(("%d\n",direction);
|
||||
//#endif
|
||||
rayCast(x,y, direction%360,5430,getTileHeightCallback);
|
||||
*pitch = MAKEINT(gPitch);
|
||||
*pitch = gPitch;
|
||||
}
|
||||
|
||||
void getPitchToHighestPoint( UDWORD x, UDWORD y, UDWORD direction,
|
||||
|
@ -595,5 +595,5 @@ void getPitchToHighestPoint( UDWORD x, UDWORD y, UDWORD direction,
|
|||
gHighestHeight = map_Height(x,y);
|
||||
gHMinDist = thresholdDistance;
|
||||
rayCast(x,y,direction%360,3000,getTileHighestCallback);
|
||||
*pitch = MAKEINT(gHPitch);
|
||||
*pitch = gHPitch;
|
||||
}
|
||||
|
|
22
src/scores.c
22
src/scores.c
|
@ -356,13 +356,13 @@ UDWORD width,height;
|
|||
|
||||
const float length = (float)infoBars[index].percent / 100.f * (float)infoBars[index].width * mul;
|
||||
|
||||
if(MAKEINT(length) > 4)
|
||||
if((int)length > 4)
|
||||
{
|
||||
|
||||
/* Black shadow */
|
||||
pie_BoxFill(x + 1, y + 3, x + MAKEINT(length) - 1, y + height - 1, WZCOL_MENU_BACKGROUND);
|
||||
pie_BoxFill(x + 1, y + 3, x + length - 1, y + height - 1, WZCOL_MENU_BACKGROUND);
|
||||
/* Solid coloured bit */
|
||||
pie_BoxFillIndex(x + 1, y + 2, x + MAKEINT(length) - 4, y + height - 4, (UBYTE)infoBars[index].colour);
|
||||
pie_BoxFillIndex(x + 1, y + 2, x + length - 4, y + height - 4, infoBars[index].colour);
|
||||
}
|
||||
}
|
||||
/* Now render the text by the bar */
|
||||
|
@ -442,7 +442,7 @@ void fillUpStats( void )
|
|||
/* Scale for percent */
|
||||
for(i=0; i<DROID_LEVELS; i++)
|
||||
{
|
||||
length = MAKEINT((scaleFactor*getNumDroidsForLevel(i)));
|
||||
length = scaleFactor * getNumDroidsForLevel(i);
|
||||
infoBars[STAT_ROOKIE+i].percent = PERCENT(length,RANK_BAR_WIDTH);
|
||||
infoBars[STAT_ROOKIE+i].number = getNumDroidsForLevel(i);
|
||||
}
|
||||
|
@ -459,9 +459,9 @@ void fillUpStats( void )
|
|||
scaleFactor = (float)STAT_BAR_WIDTH / maxi;
|
||||
}
|
||||
|
||||
length = MAKEINT(scaleFactor*missionData.unitsLost);
|
||||
length = scaleFactor * missionData.unitsLost;
|
||||
infoBars[STAT_UNIT_LOST].percent = PERCENT(length,STAT_BAR_WIDTH);
|
||||
length = MAKEINT(scaleFactor*missionData.unitsKilled);
|
||||
length = scaleFactor * missionData.unitsKilled;
|
||||
infoBars[STAT_UNIT_KILLED].percent = PERCENT(length,STAT_BAR_WIDTH);
|
||||
|
||||
/* Now do the structure losses */
|
||||
|
@ -475,9 +475,9 @@ void fillUpStats( void )
|
|||
scaleFactor = (float)STAT_BAR_WIDTH / maxi;
|
||||
}
|
||||
|
||||
length = MAKEINT(scaleFactor*missionData.strLost);
|
||||
length = scaleFactor * missionData.strLost;
|
||||
infoBars[STAT_STR_LOST].percent = PERCENT(length,STAT_BAR_WIDTH);
|
||||
length = MAKEINT(scaleFactor*missionData.strKilled);
|
||||
length = scaleFactor * missionData.strKilled;
|
||||
infoBars[STAT_STR_BLOWN_UP].percent = PERCENT(length,STAT_BAR_WIDTH);
|
||||
|
||||
/* Finally the force information - need amount of droids as well*/
|
||||
|
@ -500,11 +500,11 @@ void fillUpStats( void )
|
|||
scaleFactor = (float)STAT_BAR_WIDTH / maxi;
|
||||
}
|
||||
|
||||
length = MAKEINT(scaleFactor*missionData.unitsBuilt);
|
||||
length = scaleFactor * missionData.unitsBuilt;
|
||||
infoBars[STAT_UNITS_BUILT].percent = PERCENT(length,STAT_BAR_WIDTH);
|
||||
length = MAKEINT(scaleFactor*numUnits);
|
||||
length = scaleFactor * numUnits;
|
||||
infoBars[STAT_UNITS_NOW].percent = PERCENT(length,STAT_BAR_WIDTH);
|
||||
length = MAKEINT(scaleFactor*missionData.strBuilt);
|
||||
length = scaleFactor * missionData.strBuilt;
|
||||
infoBars[STAT_STR_BUILT].percent = PERCENT(length,STAT_BAR_WIDTH);
|
||||
|
||||
/* Finally the numbers themselves */
|
||||
|
|
|
@ -5376,12 +5376,12 @@ UDWORD newVal;
|
|||
{
|
||||
case OBJ_DROID:
|
||||
psDroid = (DROID *) psObj;
|
||||
newVal = MAKEINT((divisor*psDroid->originalBody));
|
||||
newVal = divisor * psDroid->originalBody;
|
||||
psDroid->body = newVal;
|
||||
break;
|
||||
case OBJ_STRUCTURE:
|
||||
psStructure = (STRUCTURE *) psObj;
|
||||
newVal = MAKEINT((divisor*structureBody(psStructure)));
|
||||
newVal = divisor * structureBody(psStructure);
|
||||
psStructure->body = (UWORD)newVal;
|
||||
break;
|
||||
case OBJ_FEATURE:
|
||||
|
@ -5389,7 +5389,7 @@ UDWORD newVal;
|
|||
/* Some features cannot be damaged */
|
||||
if(psFeature->psStats->damageable)
|
||||
{
|
||||
newVal = MAKEINT((divisor*psFeature->psStats->body));
|
||||
newVal = divisor * psFeature->psStats->body;
|
||||
psFeature->body = newVal;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -3891,7 +3891,7 @@ void structureUpdate(STRUCTURE *psBuilding)
|
|||
pointIndex = rand()%(psBuilding->sDisplay.imd->npoints-1);
|
||||
point = &(psBuilding->sDisplay.imd->points[pointIndex]);
|
||||
position.x = psBuilding->pos.x + point->x;
|
||||
realY = MAKEINT((structHeightScale(psBuilding) * point->y));
|
||||
realY = structHeightScale(psBuilding) * point->y;
|
||||
position.y = psBuilding->pos.z + realY;
|
||||
position.z = psBuilding->pos.y - point->z;
|
||||
|
||||
|
@ -5643,7 +5643,7 @@ BOOL calcStructureMuzzleLocation(STRUCTURE *psStructure, Vector3i *muzzle, int w
|
|||
muzzle->y = psStructure->pos.y;
|
||||
muzzle->z = psStructure->pos.z + psStructure->sDisplay.imd->max.y;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -7842,7 +7842,7 @@ void structUpdateRecoil( STRUCTURE *psStruct )
|
|||
|
||||
fraction = (float)asWeaponStats[psStruct->asWeaps[0].nStat].recoilValue / 100.f;
|
||||
|
||||
recoil = MAKEINT((float)recoil * fraction);
|
||||
recoil = (float)recoil * fraction;
|
||||
|
||||
/* Put it into the weapon data */
|
||||
psStruct->asWeaps[0].recoilValue = recoil;
|
||||
|
|
|
@ -565,7 +565,7 @@ static SDWORD getAverageTrackAngle( BOOL bCheckOnScreen )
|
|||
retVal = 0;
|
||||
}
|
||||
// FIXME: Should we return 0 when retVal is 0?
|
||||
presAvAngle = MAKEINT(averageAngleFloat);//retVal;
|
||||
presAvAngle = averageAngleFloat;//retVal;
|
||||
return presAvAngle;
|
||||
}
|
||||
|
||||
|
@ -607,7 +607,7 @@ static SDWORD getGroupAverageTrackAngle(UDWORD groupNumber, BOOL bCheckOnScreen)
|
|||
retVal = 0;
|
||||
}
|
||||
// FIXME: Return 0 when retVal is 0?
|
||||
presAvAngle = MAKEINT(averageAngleFloat);//retVal;
|
||||
presAvAngle = averageAngleFloat;//retVal;
|
||||
return presAvAngle;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue