More constiness and documentation
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1770 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
98cb1153c0
commit
db49a55df0
|
@ -33,7 +33,7 @@
|
|||
#include "lib/ivis_common/piedef.h"
|
||||
|
||||
extern void pie_InitMaths(void);
|
||||
extern UBYTE pie_ByteScale(UBYTE a, UBYTE b);
|
||||
extern UBYTE pie_ByteScale(UBYTE a, UBYTE b) WZ_DECL_CONST;
|
||||
extern void pie_TransColouredTriangle( PIEVERTEX *vrt, UDWORD rgb );
|
||||
extern void pie_DrawSkybox(float scale, int u, int v, int w, int h);
|
||||
extern void pie_DrawFogBox(float left, float right, float front, float back, float height, float wider);
|
||||
|
|
|
@ -169,7 +169,7 @@ extern BOOL pie_GetFogEnabled(void);
|
|||
extern void pie_SetFogStatus(BOOL val);
|
||||
extern BOOL pie_GetFogStatus(void);
|
||||
extern void pie_SetFogColour(UDWORD colour);
|
||||
extern UDWORD pie_GetFogColour(void);
|
||||
extern UDWORD pie_GetFogColour(void) WZ_DECL_PURE;
|
||||
extern void pie_UpdateFogDistance(float begin, float end);
|
||||
//render states
|
||||
extern void pie_SetTexturePage(SDWORD num);
|
||||
|
|
|
@ -251,5 +251,5 @@ void pie_InitMaths(void)
|
|||
|
||||
UBYTE pie_ByteScale(UBYTE a, UBYTE b)
|
||||
{
|
||||
return (((UDWORD)a)*((UDWORD)b))>>8;
|
||||
return ((UDWORD)a * (UDWORD)b) >> 8;
|
||||
}
|
||||
|
|
|
@ -385,24 +385,18 @@ void pie_MatRotX(int x)
|
|||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
//*** 3D vector perspective projection
|
||||
//*
|
||||
//* params v1 = 3D vector to project
|
||||
//* v2 = pointer to 2D resultant vector
|
||||
//*
|
||||
//* on exit v2 = projected vector
|
||||
//*
|
||||
//* returns rotated and translated z component of v1
|
||||
//*
|
||||
//******
|
||||
|
||||
Sint32 pie_RotateProject(Vector3i *v3d, Vector2i *v2d)
|
||||
/*!
|
||||
* 3D vector perspective projection
|
||||
* Projects 3D vector into 2D screen space
|
||||
* \param v3d 3D vector to project
|
||||
* \param v2d resulting 2D vector
|
||||
* \return projected z component of v2d
|
||||
*/
|
||||
Sint32 pie_RotateProject(const Vector3i *v3d, Vector2i *v2d)
|
||||
{
|
||||
Sint32 zfx, zfy;
|
||||
Sint32 zz, _x, _y, _z;
|
||||
|
||||
|
||||
_x = v3d->x * psMatrix->a + v3d->y * psMatrix->d + v3d->z * psMatrix->g + psMatrix->j;
|
||||
_y = v3d->x * psMatrix->b + v3d->y * psMatrix->e + v3d->z * psMatrix->h + psMatrix->k;
|
||||
_z = v3d->x * psMatrix->c + v3d->y * psMatrix->f + v3d->z * psMatrix->i + psMatrix->l;
|
||||
|
|
|
@ -106,7 +106,7 @@ extern void pie_MatScale( UDWORD percent );
|
|||
extern void pie_MatRotX(int x);
|
||||
extern void pie_MatRotY(int y);
|
||||
extern void pie_MatRotZ(int z);
|
||||
extern Sint32 pie_RotateProject(Vector3i *v3d, Vector2i *v2d);
|
||||
extern Sint32 pie_RotateProject(const Vector3i *src, Vector2i *dest);
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
|
|
|
@ -119,17 +119,20 @@ UDWORD bestSoFar;
|
|||
/* See header file for definition of QUAD */
|
||||
int inQuad(const POINT *pt, const QUAD *quad)
|
||||
{
|
||||
int i, j, c = 0;
|
||||
int i, j, c = 0;
|
||||
|
||||
for (i = 0, j = 3; i < 4; j = i++)
|
||||
{
|
||||
if ((((quad->coords[i].y<=pt->y) && (pt->y<quad->coords[j].y)) ||
|
||||
((quad->coords[j].y<=pt->y) && (pt->y<quad->coords[i].y))) &&
|
||||
(pt->x < (quad->coords[j].x - quad->coords[i].x) *
|
||||
(pt->y - quad->coords[i].y) / (quad->coords[j].y -
|
||||
quad->coords[i].y) + quad->coords[i].x))
|
||||
|
||||
c = !c;
|
||||
if (((quad->coords[i].y <= pt->y && pt->y < quad->coords[j].y) ||
|
||||
(quad->coords[j].y <= pt->y && pt->y < quad->coords[i].y)) &&
|
||||
(pt->x <
|
||||
(quad->coords[j].x - quad->coords[i].x)
|
||||
* (pt->y - quad->coords[i].y)
|
||||
/ (quad->coords[j].y - quad->coords[i].y)
|
||||
+ quad->coords[i].x))
|
||||
{
|
||||
c = !c;
|
||||
}
|
||||
}
|
||||
|
||||
return c;
|
||||
|
@ -160,10 +163,7 @@ SDWORD sum;
|
|||
// Approximates a square root - never more than 11% out...
|
||||
UDWORD dirtySqrt( SDWORD x1, SDWORD y1, SDWORD x2, SDWORD y2)
|
||||
{
|
||||
UDWORD xDif, yDif;
|
||||
|
||||
xDif = abs(x1 - x2);
|
||||
yDif = abs(y1 - y2);
|
||||
const UDWORD xDif = abs(x1 - x2), yDif = abs(y1 - y2);
|
||||
|
||||
return MAX(xDif, yDif) + MIN(xDif, yDif) / 2;
|
||||
}
|
||||
|
|
|
@ -25,24 +25,19 @@
|
|||
#include "map.h"
|
||||
#include "hci.h"
|
||||
|
||||
typedef struct _t_tri
|
||||
{
|
||||
POINT coords[3];
|
||||
} TRI;
|
||||
|
||||
typedef struct _t_quad
|
||||
{
|
||||
POINT coords[4];
|
||||
POINT coords[4];
|
||||
} QUAD;
|
||||
|
||||
extern UDWORD adjustDirection ( SDWORD present, SDWORD difference );
|
||||
extern SDWORD calcDirection ( UDWORD x0, UDWORD y0, UDWORD x1, UDWORD y1 );
|
||||
extern void initBulletTable ( void );
|
||||
extern int inQuad (const POINT *pt, const QUAD *quad );
|
||||
extern DROID *getNearestDroid ( UDWORD x, UDWORD y, BOOL bSelected );
|
||||
extern BOOL droidOnScreen ( DROID *psDroid, SDWORD tolerance );
|
||||
extern UDWORD adjustDirection( SDWORD present, SDWORD difference );
|
||||
extern SDWORD calcDirection( UDWORD x0, UDWORD y0, UDWORD x1, UDWORD y1 );
|
||||
extern void initBulletTable( void );
|
||||
extern int inQuad( const POINT *pt, const QUAD *quad );
|
||||
extern DROID *getNearestDroid( UDWORD x, UDWORD y, BOOL bSelected );
|
||||
extern BOOL droidOnScreen( DROID *psDroid, SDWORD tolerance );
|
||||
|
||||
extern UDWORD dirtySqrt ( SDWORD x1, SDWORD y1, SDWORD x2, SDWORD y2 );
|
||||
extern UDWORD dirtySqrt( SDWORD x1, SDWORD y1, SDWORD x2, SDWORD y2 ) WZ_DECL_CONST;
|
||||
|
||||
static inline STRUCTURE *getTileStructure(UDWORD x, UDWORD y)
|
||||
{
|
||||
|
|
|
@ -192,7 +192,7 @@ extern BOOL mapSave(char **ppFileData, UDWORD *pFileSize);
|
|||
|
||||
|
||||
/* Return a pointer to the tile structure at x,y */
|
||||
static inline MAPTILE *mapTile(UDWORD x, UDWORD y)
|
||||
static inline WZ_DECL_PURE MAPTILE *mapTile(UDWORD x, UDWORD y)
|
||||
{
|
||||
ASSERT( x < mapWidth,
|
||||
"mapTile: x coordinate bigger than map width" );
|
||||
|
@ -203,12 +203,13 @@ static inline MAPTILE *mapTile(UDWORD x, UDWORD y)
|
|||
}
|
||||
|
||||
/* Return height of tile at x,y */
|
||||
static inline SWORD map_TileHeight(UDWORD x, UDWORD y)
|
||||
static inline WZ_DECL_PURE SWORD map_TileHeight(UDWORD x, UDWORD y)
|
||||
{
|
||||
if((x>=mapWidth) || (y>=mapHeight)) {
|
||||
if ( x >= mapWidth || y >= mapHeight )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return (SWORD)((psMapTiles[x + (y * mapWidth)].height) * ELEVATION_SCALE);
|
||||
return (SWORD)(psMapTiles[x + (y * mapWidth)].height * ELEVATION_SCALE);
|
||||
}
|
||||
|
||||
/*sets the tile height */
|
||||
|
|
Loading…
Reference in New Issue