- pie_MAX_POINTS became pie_MAX_VERTICES and was increased to 768 from 512. (Grim's request.)

- pie_MAX_POLYS became pie_MAX_POLYGONS.
- pie_MAX_POLY_VERTS became pie_MAX_VERTICES_PER_POLYGON and was decreased to 6 from 10. This _should_ work everywhere, I didn't see glitches. Grim recommended to even reduce it to 4, but the terrain renderer didn't like that. (When you pitched down the camera too much, the left screen side of the terrain disappeared.)
- iV_IMD_MAX_POINTS, iV_IMD_MAX_POLYS now are defined to the pie_ variants.
- scrPoints was moved into the scope of the only using function, pie_Draw3DShape2.
- aByteScale was never used, so it got removed.
- Some counters were changed from signed to unsigned.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2054 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2007-07-11 21:09:40 +00:00
parent 41d3a2a0b0
commit 7c51ddbadc
10 changed files with 29 additions and 51 deletions

View File

@ -30,16 +30,16 @@
//*************************************************************************
#define iV_IMD_MAX_POINTS 512 // increased from 256 - Per, May 20th 2006
#define iV_IMD_MAX_POLYS 512 // increased from 256 - Per, May 20th 2006
#define iV_IMD_MAX_POINTS pie_MAX_VERTICES
#define iV_IMD_MAX_POLYS pie_MAX_POLYGONS
//*************************************************************************
// polygon flags b0..b7: col, b24..b31: anim index
#define iV_IMD_TEX 0x00000200
#define iV_IMD_TEXANIM 0x00004000 // iV_IMD_TEX must be set also
#define iV_IMD_TEX 0x00000200
#define iV_IMD_TEXANIM 0x00004000 // iV_IMD_TEX must be set also
//*************************************************************************

View File

@ -79,9 +79,9 @@
#define pie_RAISE_SCALE 256
#define pie_MAX_POINTS 512
#define pie_MAX_POLYS 512
#define pie_MAX_POLY_VERTS 10
#define pie_MAX_VERTICES 768
#define pie_MAX_POLYGONS 512
#define pie_MAX_VERTICES_PER_POLYGON 6
#define pie_FILLRED 16
#define pie_FILLGREEN 16
@ -155,7 +155,7 @@ extern void pie_DrawImage270( PIEIMAGE *image, PIERECT *dest );
extern void pie_DrawTexTriangle(const PIEVERTEX *aVrts, const void* psEffects);
extern void pie_GetResetCounts(SDWORD* pPieCount, SDWORD* pTileCount, SDWORD* pPolyCount, SDWORD* pStateCount);
extern void pie_GetResetCounts(unsigned int* pPieCount, unsigned int* pTileCount, unsigned int* pPolyCount, unsigned int* pStateCount);
void pie_BeginLighting(const Vector3f * light);
void pie_EndLighting(void);

View File

@ -32,11 +32,10 @@
#include "lib/framework/frame.h"
#include "lib/ivis_common/piedef.h"
extern void pie_InitMaths(void);
extern UBYTE pie_ByteScale(UBYTE a, UBYTE b) WZ_DECL_CONST;
extern void pie_TransColouredTriangle( PIEVERTEX *vrt, UDWORD rgb );
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);
extern void pie_DrawViewingWindow( Vector3i *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, UDWORD colour);
extern void pie_DrawViewingWindow( Vector3i *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, UDWORD colour);
#endif // _piedef_h

View File

@ -19,8 +19,8 @@
*/
#include "piestate.h"
SDWORD pieStateCount = 0; // FIXME Is this really used somewhere? Or is it just a dummy?
RENDER_STATE rendStates;
unsigned int pieStateCount = 0; // Used in pie_GetResetCounts
RENDER_STATE rendStates;
void pie_SetColourCombine(COLOUR_MODE colCombMode);
void pie_SetTranslucencyMode(TRANSLUCENCY_MODE transMode);

View File

@ -146,7 +146,7 @@ typedef struct RENDER_STATE
*/
/***************************************************************************/
extern SDWORD pieStateCount;
extern unsigned int pieStateCount;
/***************************************************************************/
/*

View File

@ -132,11 +132,10 @@ static BOOL stencil_one_pass(void)
*/
/***************************************************************************/
static Vector3f scrPoints[pie_MAX_POINTS];
static PIEVERTEXF pieVrts[pie_MAX_POLY_VERTS];
static SDWORD pieCount = 0;
static SDWORD tileCount = 0;
static SDWORD polyCount = 0;
static PIEVERTEXF pieVrts[pie_MAX_VERTICES_PER_POLYGON];
static unsigned int pieCount = 0;
static unsigned int tileCount = 0;
static unsigned int polyCount = 0;
static BOOL lighting = FALSE;
static BOOL shadows = FALSE;
@ -341,7 +340,7 @@ static unsigned int nb_tshapes = 0;
static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELIGHT specular, int pieFlag, int pieFlagData)
{
unsigned int n;
Vector3f *pVertices, *pPixels;
Vector3f *pVertices, *pPixels, scrPoints[pie_MAX_VERTICES];
iIMDPoly *pPolys;
PIEPOLY piePoly;
VERTEXID *index;
@ -1058,7 +1057,7 @@ void pie_DrawTexTriangle(const PIEVERTEX *aVrts, const void* psEffects)
}
}
void pie_GetResetCounts(SDWORD* pPieCount, SDWORD* pTileCount, SDWORD* pPolyCount, SDWORD* pStateCount)
void pie_GetResetCounts(unsigned int* pPieCount, unsigned int* pTileCount, unsigned int* pPolyCount, unsigned int* pStateCount)
{
*pPieCount = pieCount;
*pTileCount = tileCount;

View File

@ -51,9 +51,8 @@
* Local Variables
*/
/***************************************************************************/
static PIEVERTEX pieVrts[pie_MAX_POLY_VERTS];
static PIEVERTEX clippedVrts[pie_MAX_POLY_VERTS];
static UBYTE aByteScale[256][256];
static PIEVERTEX pieVrts[pie_MAX_VERTICES_PER_POLYGON];
static PIEVERTEX clippedVrts[pie_MAX_VERTICES_PER_POLYGON];
/***************************************************************************/
/*
@ -231,24 +230,6 @@ void pie_DrawFogBox(float left, float right, float front, float back, float heig
/* ---------------------------------------------------------------------------------- */
void pie_InitMaths(void)
{
UBYTE c;
UDWORD a,b,bigC;
for(a=0; a<=UBYTE_MAX; a++)
{
for(b=0; b<=UBYTE_MAX; b++)
{
bigC = a * b;
bigC /= UBYTE_MAX;
ASSERT( bigC <= UBYTE_MAX,"light_InitMaths; rounding error" );
c = (UBYTE)bigC;
aByteScale[a][b] = c;
}
}
}
UBYTE pie_ByteScale(UBYTE a, UBYTE b)
{
return ((UDWORD)a * (UDWORD)b) >> 8;

View File

@ -75,7 +75,6 @@ BOOL pie_Initialise(void)
{
int i;
pie_InitMaths();
pie_TexInit();
rendSurface.flags = REND_SURFACE_UNDEFINED;

View File

@ -103,10 +103,10 @@ static void fireWaitingCallbacks(void);
/*
* Global variables
*/
SDWORD loopPieCount;
SDWORD loopTileCount;
SDWORD loopPolyCount;
SDWORD loopStateChanges;
unsigned int loopPieCount;
unsigned int loopTileCount;
unsigned int loopPolyCount;
unsigned int loopStateChanges;
/*
* local variables

View File

@ -53,10 +53,10 @@ extern LOOP_MISSION_STATE loopMissionState;
// this is set by scrStartMission to say what type of new level is to be started
extern SDWORD nextMissionType;
extern SDWORD loopPieCount;
extern SDWORD loopTileCount;
extern SDWORD loopPolyCount;
extern SDWORD loopStateChanges;
extern unsigned int loopPieCount;
extern unsigned int loopTileCount;
extern unsigned int loopPolyCount;
extern unsigned int loopStateChanges;
extern GAMECODE gameLoop(void);
extern void videoLoop(void);