From b018e08eb7e80777e4a82ab90091ad284c080424 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 14 Jul 2003 07:46:44 +0000 Subject: [PATCH] fix loading of skins that end in ".tga" or similar (now strips image extensions off the shader name before loading the textures) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3269 d7cf8633-e32d-0410-b094-e92efae38249 --- image.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/image.c b/image.c index c1615d4c..cf6efab6 100644 --- a/image.c +++ b/image.c @@ -565,7 +565,11 @@ void Image_StripImageExtension (const char *in, char *out) if ((end - in) >= 4) { temp = end - 4; - if (strcmp(temp, ".tga") == 0 || strcmp(temp, ".pcx") == 0 || strcmp(temp, ".lmp") == 0) + if (strcmp(temp, ".tga") == 0 + || strcmp(temp, ".pcx") == 0 + || strcmp(temp, ".lmp") == 0 + || strcmp(temp, ".png") == 0 + || strcmp(temp, ".jpg") == 0) end = temp; while (in < end) *out++ = *in++; @@ -1414,11 +1418,13 @@ void Image_HeightmapToNormalmap(const unsigned char *inpixels, unsigned char *ou } } -int image_loadskin(imageskin_t *s, char *name) +int image_loadskin(imageskin_t *s, char *shadername) { int j; qbyte *bumppixels; int bumppixels_width, bumppixels_height; + char name[MAX_QPATH]; + Image_StripImageExtension(shadername, name); memset(s, 0, sizeof(*s)); s->basepixels = loadimagepixels(name, false, 0, 0); if (s->basepixels == NULL) -- 2.39.2