Use float math functions where only float precision is required.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3936 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2008-03-07 12:18:06 +00:00
parent 8fc819377a
commit 134fa94a8c
2 changed files with 23 additions and 23 deletions

View File

@ -368,9 +368,9 @@ static PIELIGHT appliedRadarColour(RADAR_DRAW_MODE radarDrawMode, MAPTILE *WTile
// draw radar terrain on/off feature
PIELIGHT col = tileColours[TileNumber_tile(WTile->texture)];
col.byte.r = sqrt(col.byte.r * WTile->illumination);
col.byte.b = sqrt(col.byte.b * WTile->illumination);
col.byte.g = sqrt(col.byte.g * WTile->illumination);
col.byte.r = sqrtf(col.byte.r * WTile->illumination);
col.byte.b = sqrtf(col.byte.b * WTile->illumination);
col.byte.g = sqrtf(col.byte.g * WTile->illumination);
WScr = col;
}
break;
@ -379,9 +379,9 @@ static PIELIGHT appliedRadarColour(RADAR_DRAW_MODE radarDrawMode, MAPTILE *WTile
// draw radar terrain on/off feature
PIELIGHT col = tileColours[TileNumber_tile(WTile->texture)];
col.byte.r = sqrt(col.byte.r * (WTile->illumination + WTile->height) / 2);
col.byte.b = sqrt(col.byte.b * (WTile->illumination + WTile->height) / 2);
col.byte.g = sqrt(col.byte.g * (WTile->illumination + WTile->height) / 2);
col.byte.r = sqrtf(col.byte.r * (WTile->illumination + WTile->height) / 2);
col.byte.b = sqrtf(col.byte.b * (WTile->illumination + WTile->height) / 2);
col.byte.g = sqrtf(col.byte.g * (WTile->illumination + WTile->height) / 2);
WScr = col;
}
break;
@ -468,9 +468,9 @@ static void DrawRadarTiles(UDWORD *screen,UDWORD Modulus,UWORD boxSizeH,UWORD bo
UDWORD Val, c, d;
UDWORD *Ptr = Scr + j + i * Modulus;
col.byte.r = sqrt(col.byte.r * WTile->illumination);
col.byte.b = sqrt(col.byte.b * WTile->illumination);
col.byte.g = sqrt(col.byte.g * WTile->illumination);
col.byte.r = sqrtf(col.byte.r * WTile->illumination);
col.byte.b = sqrtf(col.byte.b * WTile->illumination);
col.byte.g = sqrtf(col.byte.g * WTile->illumination);
Val = col.argb;
for(c=0; c<SizeV; c++)
@ -622,15 +622,15 @@ static void DrawRadarObjects(UDWORD *screen,UDWORD Modulus,UWORD boxSizeH,UWORD
{
playerCol = (aiCheckAlliances(selectedPlayer,clan) ? colRadarAlly: colRadarEnemy);
}
}
else
}
else
{
//original 8-color mode
playerCol = clanColours[getPlayerColour(clan)];
}
flashCol = flashColours[getPlayerColour(clan)];
/* Go through all structures */
for(psStruct = apsStructLists[clan]; psStruct != NULL;
psStruct = psStruct->psNext)

View File

@ -27,7 +27,7 @@
#include <stdio.h>
#include "lib/framework/frame.h"
#include "lib/framework/trig.h"
#include "lib/framework/math-help.h"
#include "objects.h"
#include "map.h"
@ -69,11 +69,11 @@ static SDWORD rayFPInvCos[NUM_RAYS], rayFPInvSin[NUM_RAYS];
BOOL rayInitialise(void)
{
SDWORD i;
float angle = 0.f;
float val;
SDWORD i;
float angle = 0.0f;
float val;
for(i=0; i<NUM_RAYS; i++)
for(i = 0; i < NUM_RAYS; i++)
{
// Set up the fixed offset tables for calculating the intersection points
val = tanf(angle);
@ -101,9 +101,9 @@ BOOL rayInitialise(void)
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;
val = sinf(angle);
if(val == 0.0f) {
val = 1.0f;
}
rayFPInvSin[i] = (float)RAY_ACCMUL / val;
if (i >= NUM_RAYS/2)
@ -115,9 +115,9 @@ BOOL rayInitialise(void)
rayVDist[i] = (float)TILE_UNITS / val;
}
val = (float)cos(angle);
if(val == 0) {
val = (float)1;
val = cosf(angle);
if(val == 0.0f) {
val = 1.0f;
}
rayFPInvCos[i] = (float)RAY_ACCMUL / val;
if (i < NUM_RAYS/4 || i > 3*NUM_RAYS/4)