diff --git a/changelog.txt b/changelog.txt index fc10f85..8403eb4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,8 @@ DD Mmm 17 - 1.49 +fix: the ct3ctf1 grate near quad was getting picmipped when it wasn't supposed to be + fix: improved the player name look-up behavior for these commands: kick, banUser, dumpuser if 2 players had the same name, it would just pick the first one (lowest client number) diff --git a/code/renderer/tr_bsp.cpp b/code/renderer/tr_bsp.cpp index 0e3fdc2..52ad015 100644 --- a/code/renderer/tr_bsp.cpp +++ b/code/renderer/tr_bsp.cpp @@ -1523,3 +1523,9 @@ void RE_LoadWorldMap( const char* name ) ri.FS_FreeFile( buffer ); } + +const char* R_GetMapName() +{ + return s_worldData.baseName[0] != '\0' ? s_worldData.baseName : ""; +} + diff --git a/code/renderer/tr_image.cpp b/code/renderer/tr_image.cpp index e7c9a5e..5704a3c 100644 --- a/code/renderer/tr_image.cpp +++ b/code/renderer/tr_image.cpp @@ -769,35 +769,60 @@ static void R_LoadImage( const char* name, byte** pic, int* w, int* h, GLenum* f } +struct forcedLoadImage_t { + const char* mapName; + const char* shaderName; + int shaderNameHash; +}; + +// map-specific fixes for textures that are used with different (incompatible) settings +static const forcedLoadImage_t g_forcedLoadImages[] = { + { "ct3ctf1", "textures/ct3ctf1/grate_02.tga", 716 } +}; + + // finds or loads the given image - returns NULL if it fails, not a default image const image_t* R_FindImageFile( const char* name, int flags, int glWrapClampMode ) { - if (!name) + if ( !name ) return NULL; - - int hash = Q_FileHash(name, IMAGE_HASH_SIZE); - + + qbool forcedLoad = qfalse; + const int hash = Q_FileHash( name, IMAGE_HASH_SIZE ); + const int forcedLoadImageCount = ARRAY_LEN( g_forcedLoadImages ); + for ( int i = 0; i < forcedLoadImageCount; ++i ) { + const forcedLoadImage_t* const fli = g_forcedLoadImages + i; + if ( hash == fli->shaderNameHash && + strcmp( R_GetMapName(), fli->mapName ) == 0 && + strcmp( name, fli->shaderName ) == 0 ) + forcedLoad = qtrue; + } + // see if the image is already loaded // - image_t* image; - for (image=hashTable[hash]; image; image=image->next) { - if ( !strcmp( name, image->name ) ) { - /* since this WASN'T enforced as an error, half the shaders out there (including most of id's) - have been geting it wrong for years and this is just useless noise + if ( !forcedLoad ) { + image_t* image; + for ( image = hashTable[hash]; image; image=image->next ) { + if ( strcmp( name, image->name ) ) + continue; + + if ( strcmp( name, "*white" ) ) + return image; + + // since this WASN'T enforced as an error, half the shaders out there (including most of id's) + // have been getting it wrong for years // the white image can be used with any set of parms, but other mismatches are errors - if ( strcmp( name, "*white" ) ) { - if ( image->mipmap != mipmap ) { - ri.Printf( PRINT_DEVELOPER, "WARNING: reused image %s with mixed mipmap parm\n", name ); - } - if ( image->allowPicmip != allowPicmip ) { - ri.Printf( PRINT_DEVELOPER, "WARNING: reused image %s with mixed allowPicmip parm\n", name ); - } - if ( image->wrapClampMode != glWrapClampMode ) { - ri.Printf( PRINT_ALL, "WARNING: reused image %s with mixed glWrapClampMode parm\n", name ); - } + if ( (image->flags & IMG_NOMIPMAP) != (flags & IMG_NOMIPMAP) ) { + ri.Printf( PRINT_DEVELOPER, "WARNING: reused image %s with mixed nomipmap settings\n", name ); } - */ + if ( (image->flags & IMG_NOPICMIP) != (image->flags & IMG_NOPICMIP) ) { + ri.Printf( PRINT_DEVELOPER, "WARNING: reused image %s with mixed nomipmaps settings\n", name ); + } + if ( image->wrapClampMode != glWrapClampMode ) { + ri.Printf( PRINT_DEVELOPER, "WARNING: reused image %s with mixed clamp settings (map vs clampMap)\n", name ); + } + return image; } } @@ -809,10 +834,10 @@ const image_t* R_FindImageFile( const char* name, int flags, int glWrapClampMode GLenum format; R_LoadImage( name, &pic, &width, &height, &format ); - if (!pic) + if ( !pic ) return NULL; - image = R_CreateImage( name, pic, width, height, format, flags, glWrapClampMode ); + image_t* const image = R_CreateImage( name, pic, width, height, format, flags, glWrapClampMode ); ri.Free( pic ); return image; } diff --git a/code/renderer/tr_local.h b/code/renderer/tr_local.h index d1819df..5960367 100644 --- a/code/renderer/tr_local.h +++ b/code/renderer/tr_local.h @@ -1111,6 +1111,8 @@ void RE_SetWorldVisData( const byte *vis ); qhandle_t RE_RegisterModel( const char *name ); qhandle_t RE_RegisterSkin( const char *name ); +const char* R_GetMapName(); + qbool R_GetEntityToken( char *buffer, int size ); model_t* R_AllocModel();