Merge pull request #521 from 0lvin/for_review

Small cleanup
This commit is contained in:
Yamagi 2020-02-27 18:50:36 +01:00 committed by GitHub
commit 373ecdf429
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 59 deletions

View file

@ -409,53 +409,6 @@ R_FloodFillSkin(byte *skin, int skinwidth, int skinheight)
}
}
void
R_ResampleTexture(unsigned *in, int inwidth, int inheight,
unsigned *out, int outwidth, int outheight)
{
int i, j;
unsigned *inrow, *inrow2;
unsigned frac, fracstep;
unsigned p1[1024], p2[1024];
byte *pix1, *pix2, *pix3, *pix4;
fracstep = inwidth * 0x10000 / outwidth;
frac = fracstep >> 2;
for (i = 0; i < outwidth; i++)
{
p1[i] = 4 * (frac >> 16);
frac += fracstep;
}
frac = 3 * (fracstep >> 2);
for (i = 0; i < outwidth; i++)
{
p2[i] = 4 * (frac >> 16);
frac += fracstep;
}
for (i = 0; i < outheight; i++, out += outwidth)
{
inrow = in + inwidth * (int)((i + 0.25) * inheight / outheight);
inrow2 = in + inwidth * (int)((i + 0.75) * inheight / outheight);
for (j = 0; j < outwidth; j++)
{
pix1 = (byte *)inrow + p1[j];
pix2 = (byte *)inrow + p2[j];
pix3 = (byte *)inrow2 + p1[j];
pix4 = (byte *)inrow2 + p2[j];
((byte *)(out + j))[0] = (pix1[0] + pix2[0] + pix3[0] + pix4[0]) >> 2;
((byte *)(out + j))[1] = (pix1[1] + pix2[1] + pix3[1] + pix4[1]) >> 2;
((byte *)(out + j))[2] = (pix1[2] + pix2[2] + pix3[2] + pix4[2]) >> 2;
((byte *)(out + j))[3] = (pix1[3] + pix2[3] + pix3[3] + pix4[3]) >> 2;
}
}
}
/*
* Scale up the pixel values in a
* texture to increase the
@ -702,8 +655,8 @@ R_Upload32Soft(unsigned *data, int width, int height, qboolean mipmap)
}
else
{
R_ResampleTexture(data, width, height, scaled,
scaled_width, scaled_height);
ResizeSTB((byte *)data, width, height,
(byte *)scaled, scaled_width, scaled_height);
}
R_LightScaleTexture(scaled, scaled_width, scaled_height, !mipmap);

View file

@ -282,9 +282,6 @@ void R_SwapBuffers(int);
int Draw_GetPalette(void);
void R_ResampleTexture(unsigned *in, int inwidth, int inheight,
unsigned *out, int outwidth, int outheight);
image_t *R_LoadPic(char *name, byte *pic, int width, int realwidth,
int height, int realheight, imagetype_t type, int bits);
image_t *R_FindImage(char *name, imagetype_t type);

View file

@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <string.h>
#include <stdarg.h>
#define REF_VERSION "SOFT 0.01"
#define REF_VERSION "Yamagi Quake II Software Refresher"
// up / down
#define PITCH 0

View file

@ -423,6 +423,9 @@ R_Init
static qboolean
RE_Init(void)
{
R_Printf(PRINT_ALL, "Refresh: " REF_VERSION "\n");
R_Printf(PRINT_ALL, "Client: " YQ2VERSION "\n\n");
R_RegisterVariables ();
R_InitImages ();
Mod_Init ();
@ -455,8 +458,6 @@ RE_Init(void)
// create the window
ri.Vid_MenuInit();
R_Printf(PRINT_ALL, "ref_soft version: "REF_VERSION"\n");
return true;
}
@ -1480,7 +1481,7 @@ RE_SetMode(void)
vid_fullscreen->modified = false;
R_Printf(PRINT_ALL, "%s() - fullscreen unavailable in this mode\n", __func__);
if ((err = SWimp_SetMode(&vid.width, &vid.height, r_mode->value, 0)) == rserr_ok)
if ((SWimp_SetMode(&vid.width, &vid.height, r_mode->value, 0)) == rserr_ok)
{
return true;
}
@ -1501,7 +1502,7 @@ RE_SetMode(void)
}
/* try setting it back to something safe */
if ((err = SWimp_SetMode(&vid.width, &vid.height, sw_state.prev_mode, 0)) != rserr_ok)
if ((SWimp_SetMode(&vid.width, &vid.height, sw_state.prev_mode, 0)) != rserr_ok)
{
R_Printf(PRINT_ALL, "%s() - could not revert to safe mode\n", __func__);
return false;

View file

@ -140,7 +140,7 @@ Mod_ForName (char *name, qboolean crash)
if (i == mod_numknown)
{
if (mod_numknown == MAX_MOD_KNOWN)
ri.Sys_Error(ERR_DROP, "mod_numknown == MAX_MOD_KNOWN");
ri.Sys_Error(ERR_DROP, "%s: mod_numknown == MAX_MOD_KNOWN", __func__);
mod_numknown++;
}
strcpy (mod->name, name);
@ -962,7 +962,7 @@ Mod_LoadBrushModel(model_t *mod, void *buffer, int modfilelen)
dmodel_t *bm;
if (loadmodel != mod_known)
ri.Sys_Error(ERR_DROP, "Loaded a brush model after the world");
ri.Sys_Error(ERR_DROP, "%s: Loaded a brush model after the world", __func__);
header = (dheader_t *)buffer;