Skip to content

Commit

Permalink
Added the Flats external resource category
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 8, 2005
1 parent 4c6c3da commit 7831c28
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
3 changes: 2 additions & 1 deletion doomsday/Include/r_extres.h
Expand Up @@ -26,7 +26,8 @@
* Resource classes. Each has its own subdir under Data\Game\.
*/
typedef enum resourceclass_e {
RC_TEXTURE, // And flats.
RC_TEXTURE,
RC_FLAT,
RC_PATCH, // Not sprites, mind you. Names == lumpnames.
RC_LIGHTMAP,
RC_MUSIC, // Names == lumpnames.
Expand Down
24 changes: 16 additions & 8 deletions doomsday/Src/gl_tex.c
Expand Up @@ -1963,16 +1963,16 @@ void GL_DestroyImage(image_t * img)
// GL_LoadHighRes
// Name must end in \0.
//===========================================================================
byte *GL_LoadHighRes(image_t * img, char *name, char *prefix,
boolean allowColorKey)
byte *GL_LoadHighRes(image_t *img, char *name, char *prefix,
boolean allowColorKey, resourceclass_t resClass)
{
filename_t resource, fileName;

// Form the resource name.
sprintf(resource, "%s%s", prefix, name);

if(!R_FindResource
(RC_TEXTURE, resource, allowColorKey ? "-ck" : NULL, fileName))
(resClass, resource, allowColorKey ? "-ck" : NULL, fileName))
{
// There is no such external resource file.
return NULL;
Expand All @@ -1986,17 +1986,17 @@ byte *GL_LoadHighRes(image_t * img, char *name, char *prefix,
// Use this when loading custom textures from the Data\*\Textures dir.
// The returned buffer must be freed with M_Free.
//===========================================================================
byte *GL_LoadTexture(image_t * img, char *name)
byte *GL_LoadTexture(image_t * img, char *name)
{
return GL_LoadHighRes(img, name, "", true);
return GL_LoadHighRes(img, name, "", true, RC_TEXTURE);
}

//===========================================================================
// GL_LoadHighResTexture
// Use this when loading high-res wall textures.
// The returned buffer must be freed with M_Free.
//===========================================================================
byte *GL_LoadHighResTexture(image_t * img, char *name)
byte *GL_LoadHighResTexture(image_t * img, char *name)
{
if(noHighResTex)
return NULL;
Expand All @@ -2007,11 +2007,19 @@ byte *GL_LoadHighResTexture(image_t * img, char *name)
// GL_LoadHighResFlat
// The returned buffer must be freed with M_Free.
//===========================================================================
byte *GL_LoadHighResFlat(image_t * img, char *name)
byte *GL_LoadHighResFlat(image_t * img, char *name)
{
byte *ptr;

if(noHighResTex)
return NULL;
return GL_LoadHighRes(img, name, "Flat-", false);

// First try the Flats category.
if((ptr = GL_LoadHighRes(img, name, "", false, RC_FLAT)) != NULL)
return ptr;

// Try the old-fashioned "Flat-NAME" in the Textures category.
return GL_LoadHighRes(img, name, "Flat-", false, RC_TEXTURE);
}

//===========================================================================
Expand Down
3 changes: 3 additions & 0 deletions doomsday/Src/r_extres.c
Expand Up @@ -58,6 +58,7 @@ char dataPath[256];
// Command line options for setting the path explicitly.
static char *explicitOption[NUM_RESOURCE_CLASSES][2] = {
{"-texdir", "-texdir2"},
{"-flatdir", "-flatdir2"},
{"-patdir", "-patdir2"},
{"-lmdir", "-lmdir2"},
{"-musdir", "-musdir2"},
Expand All @@ -68,6 +69,7 @@ static char *explicitOption[NUM_RESOURCE_CLASSES][2] = {
// Class paths.
static const char *defaultResourcePath[NUM_RESOURCE_CLASSES] = {
"Textures\\",
"Flats\\",
"Patches\\",
"LightMaps\\",
"Music\\",
Expand All @@ -81,6 +83,7 @@ static const char *classExtension[NUM_RESOURCE_CLASSES][MAX_EXTENSIONS] = {
{".png", ".tga", ".pcx", NULL},
{".png", ".tga", ".pcx", NULL},
{".png", ".tga", ".pcx", NULL},
{".png", ".tga", ".pcx", NULL},

// Extension doesn't matter with music, FMOD will either recognize
// it or not.
Expand Down

0 comments on commit 7831c28

Please sign in to comment.