diff --git a/src/client/refresh/files/stb.c b/src/client/refresh/files/stb.c index 4d10ff77..552b72d7 100644 --- a/src/client/refresh/files/stb.c +++ b/src/client/refresh/files/stb.c @@ -488,7 +488,7 @@ LoadHiColorImage(const char *name, const char* namewe, const char *ext, static struct image_s * LoadImage_Ext(const char *name, const char* namewe, const char *ext, imagetype_t type, - qboolean r_retexturing, loadimage_t load_image) + int r_retexturing, loadimage_t load_image) { struct image_s *image = NULL; @@ -502,9 +502,9 @@ LoadImage_Ext(const char *name, const char* namewe, const char *ext, imagetype_t { if (!strcmp(ext, "pcx")) { + int width = 0, height = 0, realwidth = 0, realheight = 0; byte *pic = NULL; byte *palette = NULL; - int width = 0, height = 0; LoadPCX (namewe, &pic, &palette, &width, &height); if (!pic) @@ -512,6 +512,25 @@ LoadImage_Ext(const char *name, const char* namewe, const char *ext, imagetype_t return NULL; } + realheight = height; + realwidth = width; + + if (r_retexturing >= 2) + { + byte *image_scale = NULL; + + /* scale image paletted images */ + image_scale = malloc(width * height * 4); + scale2x(pic, image_scale, width, height); + + /* replace pic with scale */ + free(pic); + pic = image_scale; + + width *= 2; + height *= 2; + } + if (r_retexturing && palette) { byte *image_buffer = NULL; @@ -519,6 +538,7 @@ LoadImage_Ext(const char *name, const char* namewe, const char *ext, imagetype_t size = width * height; + /* convert to full color */ image_buffer = malloc (size * 4); for(i = 0; i < size; i++) { @@ -530,8 +550,8 @@ LoadImage_Ext(const char *name, const char* namewe, const char *ext, imagetype_t } image = load_image(name, image_buffer, - width, width, - height, height, + width, realwidth, + height, realheight, size, type, 32); free (image_buffer); } @@ -590,7 +610,7 @@ LoadImage_Ext(const char *name, const char* namewe, const char *ext, imagetype_t struct image_s * R_LoadImage(const char *name, const char* namewe, const char *ext, imagetype_t type, - qboolean r_retexturing, loadimage_t load_image) + int r_retexturing, loadimage_t load_image) { struct image_s *image = NULL; diff --git a/src/client/refresh/ref_shared.h b/src/client/refresh/ref_shared.h index 6c0f9950..2d147d97 100644 --- a/src/client/refresh/ref_shared.h +++ b/src/client/refresh/ref_shared.h @@ -339,7 +339,7 @@ extern struct image_s *GetSkyImage(const char *skyname, const char* surfname, extern struct image_s *GetTexImage(const char *name, findimage_t find_image); extern struct image_s *R_FindPic(const char *name, findimage_t find_image); extern struct image_s *R_LoadImage(const char *name, const char* namewe, const char *ext, - imagetype_t type, qboolean r_retexturing, loadimage_t load_image); + imagetype_t type, int r_retexturing, loadimage_t load_image); extern void Mod_LoadQBSPMarksurfaces(const char *name, msurface_t ***marksurfaces, unsigned int *nummarksurfaces, msurface_t *surfaces, int numsurfaces, const byte *mod_base, const lump_t *lMod_LoadQBSPMarksurfaces);