diff --git a/lib/ivis_common/piedef.h b/lib/ivis_common/piedef.h index 929af7fc7..907ed465b 100644 --- a/lib/ivis_common/piedef.h +++ b/lib/ivis_common/piedef.h @@ -52,13 +52,17 @@ #define FP12_MULTIPLIER (1 << FP12_SHIFT) #define STRETCHED_Z_SHIFT 10 // stretchs z range for (1000 to 4000) to (8000 to 32000) -#define MAX_Z (32000.0f) // raised to 32000 from 6000 when stretched +#define MAX_Z (32000) // raised to 32000 from 6000 when stretched #define MIN_STRETCHED_Z 256 #define LONG_WAY (1<<15) #define LONG_TEST (1<<14) -#define INTERFACE_DEPTH (MAX_Z - 1.0f) +#define INTERFACE_DEPTH (MAX_Z - 1) #define BUTTON_DEPTH 2000 // will be stretched to 16000 +// Amount of visible terrain tiles in x/y direction +#define VISIBLE_XTILES 64 +#define VISIBLE_YTILES 64 + #define OLD_TEXTURE_SIZE_FIX 256.0f //Render style flags for all pie draw functions diff --git a/lib/ivis_opengl/piedraw.c b/lib/ivis_opengl/piedraw.c index 1bc17ea90..f3c4daef2 100644 --- a/lib/ivis_opengl/piedraw.c +++ b/lib/ivis_opengl/piedraw.c @@ -36,11 +36,14 @@ #include "lib/ivis_common/pieclip.h" #include "piematrix.h" +#define SHADOW_END_DISTANCE (8000*8000) // Keep in sync with lighting.c:FOG_END + #define VERTICES_PER_TRIANGLE 3 #define COLOUR_COMPONENTS 4 #define TEXCOORD_COMPONENTS 2 #define VERTEX_COMPONENTS 3 -#define MAP_TRIANGLES (64 * 64 * 2) // two triangles per tile + +#define MAP_TRIANGLES (VISIBLE_YTILES * VISIBLE_XTILES * 2) // two triangles per tile #define MAP_VERTICES (VERTICES_PER_TRIANGLE * MAP_TRIANGLES) static GLubyte aColour[COLOUR_COMPONENTS * MAP_VERTICES]; @@ -59,7 +62,7 @@ BOOL check_extension(const char *extName) char *end; size_t extNameLen= strlen(extName); - end = p + strlen(p); + end = p + strlen(p); while (p < end) { int n = strcspn(p, " "); @@ -734,7 +737,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, PIE distance += scshapes[nb_scshapes].matrix[14] * scshapes[nb_scshapes].matrix[14]; // if object is too far in the fog don't generate a shadow. - if (distance < 6000*6000) + if (distance < SHADOW_END_DISTANCE) { float invmat[9], pos_light0[4]; diff --git a/lib/ivis_opengl/piefunc.c b/lib/ivis_opengl/piefunc.c index 95c9b541c..1f1bdaf21 100644 --- a/lib/ivis_opengl/piefunc.c +++ b/lib/ivis_opengl/piefunc.c @@ -50,7 +50,7 @@ void pie_DrawViewingWindow(Vector3i *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD pieVrts[0].pos.x = v[1].x; pieVrts[0].pos.y = v[1].y; //cull triangles with off screen points - pieVrts[0].pos.z = (int)INTERFACE_DEPTH; + pieVrts[0].pos.z = INTERFACE_DEPTH; pieVrts[0].u = 0; pieVrts[0].v = 0; diff --git a/src/display3ddef.h b/src/display3ddef.h index e7146da96..01b4e9a24 100644 --- a/src/display3ddef.h +++ b/src/display3ddef.h @@ -31,8 +31,4 @@ #define RADBRX (RADTLX + RADWIDTH) -1 #define RADBRY (RADTLY + RADHEIGHT) -1 -//assigned to variable visibleXtiles, visibleYTiles 25/02/98 AB -#define VISIBLE_XTILES 64 -#define VISIBLE_YTILES 64 - #endif diff --git a/src/lighting.c b/src/lighting.c index 6ed221438..ff031b382 100644 --- a/src/lighting.c +++ b/src/lighting.c @@ -41,8 +41,8 @@ // These values determine the fog when fully zoomed in // Determine these when fully zoomed in -#define FOG_END 3500 -#define FOG_DEPTH 800 +#define FOG_DEPTH 1000 +#define FOG_END 6500 // These values are multiplied by the camera distance // to obtain the optimal settings when fully zoomed out @@ -506,18 +506,10 @@ static void colourTile(SDWORD xIndex, SDWORD yIndex, LIGHT_COLOUR colouridx, UBY /// "popping" tiles void UpdateFogDistance(float distance) { - pie_UpdateFogDistance(FOG_END-FOG_DEPTH+distance*FOG_BEGIN_SCALE, FOG_END+distance*FOG_END_SCALE); + pie_UpdateFogDistance(FOG_END-FOG_DEPTH + distance*FOG_BEGIN_SCALE, FOG_END + distance*FOG_END_SCALE); } -//three fog modes, background fog, distance fog, ground mist - - -#define UMBRA_RADIUS 384 -#define FOG_RADIUS 384 //256 too abrupt at edges -#define FOG_START 512 -#define FOG_RATE 10 - #define MIN_DROID_LIGHT_LEVEL 96 #define DROID_SEEK_LIGHT_SPEED 2