Skip to content

Commit

Permalink
Added: JPG as a recognized graphics resource type
Browse files Browse the repository at this point in the history
The resource locator now looks for JPG files in addition to PNG, TGA and PCX.
  • Loading branch information
skyjake committed Jun 15, 2012
1 parent 7a4faea commit 111c395
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions doomsday/engine/portable/include/sys_reslocator.h
Expand Up @@ -61,6 +61,7 @@ typedef enum {
RT_WAD,
RT_DED,
RT_PNG,
RT_JPG,
RT_TGA,
RT_PCX,
RT_DMD,
Expand Down
3 changes: 1 addition & 2 deletions doomsday/engine/portable/src/image.cpp
Expand Up @@ -146,9 +146,8 @@ boolean Image_Load(image_t* img, const char* format, DFile* file)
GL_InitImage(img);

// Load the file contents to a memory buffer.
int pos = DFile_Tell(file);
QByteArray data;
data.resize(DFile_Length(file) - pos);
data.resize(DFile_Length(file) - initPos);
DFile_Read(file, reinterpret_cast<uint8_t*>(data.data()), data.size());

QImage image = QImage::fromData(data, format).rgbSwapped();
Expand Down
3 changes: 2 additions & 1 deletion doomsday/engine/portable/src/sys_reslocator.c
Expand Up @@ -90,6 +90,7 @@ static const resourcetypeinfo_t typeInfo[NUM_RESOURCE_TYPES] = {
/* RT_WAD */ { RC_PACKAGE, {"wad", 0} },
/* RT_DED */ { RC_DEFINITION, {"ded", 0} },
/* RT_PNG */ { RC_GRAPHIC, {"png", 0} },
/* RT_JPG */ { RC_GRAPHIC, {"jpg", 0} },
/* RT_TGA */ { RC_GRAPHIC, {"tga", 0} },
/* RT_PCX */ { RC_GRAPHIC, {"pcx", 0} },
/* RT_DMD */ { RC_MODEL, {"dmd", 0} },
Expand All @@ -108,7 +109,7 @@ static const resourcetypeinfo_t typeInfo[NUM_RESOURCE_TYPES] = {
static const resourcetype_t searchTypeOrder[RESOURCECLASS_COUNT][MAX_TYPEORDER] = {
/* RC_PACKAGE */ { RT_ZIP, RT_WAD, 0 }, // Favor ZIP over WAD.
/* RC_DEFINITION */ { RT_DED, 0 }, // Only DED files.
/* RC_GRAPHIC */ { RT_PNG, RT_TGA, RT_PCX, 0 }, // Favour quality.
/* RC_GRAPHIC */ { RT_PNG, RT_TGA, RT_JPG, RT_PCX, 0 }, // Favour quality.
/* RC_MODEL */ { RT_DMD, RT_MD2, 0 }, // Favour DMD over MD2.
/* RC_SOUND */ { RT_WAV, 0 }, // Only WAV files.
/* RC_MUSIC */ { RT_OGG, RT_MP3, RT_WAV, RT_MOD, RT_MID, 0 },
Expand Down

0 comments on commit 111c395

Please sign in to comment.