Define NUM_MIPS=4 instead hardcoded value

This commit is contained in:
Denis Pauk 2018-04-28 17:46:39 +03:00
parent 184ff91453
commit 4fd37b73ca
4 changed files with 15 additions and 15 deletions

View file

@ -56,6 +56,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#define NUM_MIPS 4
typedef struct image_s typedef struct image_s
{ {
char name[MAX_QPATH]; // game path, including extension char name[MAX_QPATH]; // game path, including extension
@ -63,7 +65,7 @@ typedef struct image_s
int width, height; int width, height;
qboolean transparent; // true if any 255 pixels in image qboolean transparent; // true if any 255 pixels in image
int registration_sequence; // 0 = free int registration_sequence; // 0 = free
byte *pixels[4]; // mip levels byte *pixels[NUM_MIPS]; // mip levels
} image_t; } image_t;
@ -393,7 +395,7 @@ extern zvalue_t *d_pzbuffer;
extern unsigned int d_zwidth; extern unsigned int d_zwidth;
extern int d_minmip; extern int d_minmip;
extern float d_scalemip[3]; extern float d_scalemip[NUM_MIPS-1];
//=================================================================== //===================================================================

View file

@ -709,16 +709,16 @@ D_MipLevelForScale
static int static int
D_MipLevelForScale (float scale) D_MipLevelForScale (float scale)
{ {
int lmiplevel; int lmiplevel = NUM_MIPS-1, i;
if (scale >= d_scalemip[0] ) for (i=0; i < NUM_MIPS-1; i ++)
lmiplevel = 0; {
else if (scale >= d_scalemip[1] ) if (scale >= d_scalemip[i])
lmiplevel = 1; {
else if (scale >= d_scalemip[2] ) lmiplevel = i;
lmiplevel = 2; break;
else }
lmiplevel = 3; }
if (lmiplevel < d_minmip) if (lmiplevel < d_minmip)
lmiplevel = d_minmip; lmiplevel = d_minmip;

View file

@ -26,8 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "header/local.h" #include "header/local.h"
#define NUM_MIPS 4
cvar_t *sw_mipcap; cvar_t *sw_mipcap;
cvar_t *sw_mipscale; cvar_t *sw_mipscale;

View file

@ -96,7 +96,7 @@ static void R_DrawSurface (void)
texwidth = mt->width >> r_drawsurf.surfmip; texwidth = mt->width >> r_drawsurf.surfmip;
blocksize = 16 >> r_drawsurf.surfmip; blocksize = 16 >> r_drawsurf.surfmip;
blockdivshift = 4 - r_drawsurf.surfmip; blockdivshift = NUM_MIPS - r_drawsurf.surfmip;
r_lightwidth = (r_drawsurf.surf->extents[0]>>4)+1; r_lightwidth = (r_drawsurf.surf->extents[0]>>4)+1;
@ -134,7 +134,7 @@ static void R_DrawSurface (void)
pbasesource = basetptr + soffset; pbasesource = basetptr + soffset;
R_DrawSurfaceBlock8_anymip(4-r_drawsurf.surfmip); R_DrawSurfaceBlock8_anymip(NUM_MIPS - r_drawsurf.surfmip);
soffset = soffset + blocksize; soffset = soffset + blocksize;
if (soffset >= smax) if (soffset >= smax)