+2014-12-13
+ * fixed loading custom PCX image files with default artwork file names
+ (like "RocksDoor.pcx") which are not redefined in artwork config file
+ (this is a special fix for Zelda 2 and probably some other existing
+ level sets which use new graphics which are not defined in the file
+ "graphicsinfo.conf", but use a file name of one of default graphics
+ (like "RocksScreen.pcx"); this did not work anymore for PCX files
+ since the default graphics files have been changed to PNG files, so
+ different file names are checked now (like "RocksScreen.png"), so if
+ the PNG files cannot be found, the old PCX files are also checked)
+
2014-12-03
* added some more graphics customization options for the level editor:
- editor.button.prev_level (position)
return getStringCat3WithSeparator(path1, path2, path3, STRING_PATH_SEPARATOR);
}
+char *getImg2(char *path1, char *path2)
+{
+ char *filename = getPath2(path1, path2);
+
+ if (!fileExists(filename) && strSuffix(path2, ".png"))
+ {
+ // backward compatibility: if PNG file not found, check for PCX file
+ char *path2pcx = getStringCopy(path2);
+
+ strcpy(&path2pcx[strlen(path2pcx) - 3], "pcx");
+
+ free(filename);
+
+ filename = getPath2(path1, path2pcx);
+
+ free(path2pcx);
+ }
+
+ return filename;
+}
+
+char *getImg3(char *path1, char *path2, char *path3)
+{
+ char *filename = getPath3(path1, path2, path3);
+
+ if (!fileExists(filename) && strSuffix(path3, ".png"))
+ {
+ // backward compatibility: if PNG file not found, check for PCX file
+ char *path3pcx = getStringCopy(path3);
+
+ strcpy(&path3pcx[strlen(path3pcx) - 3], "pcx");
+
+ free(filename);
+
+ filename = getPath3(path1, path2, path3pcx);
+
+ free(path3pcx);
+ }
+
+ return filename;
+}
+
char *getStringCopy(const char *s)
{
char *s_copy;
char *getStringCat3(char *, char *, char *);
char *getPath2(char *, char *);
char *getPath3(char *, char *, char*);
+char *getImg2(char *, char *);
+char *getImg3(char *, char *, char*);
char *getStringCopy(const char *);
char *getStringCopyN(const char *, int);
char *getStringCopyNStatic(const char *, int);
if (!gfx.override_level_graphics)
{
/* 1st try: look for special artwork in current level series directory */
- filename = getPath3(getCurrentLevelDir(), GRAPHICS_DIRECTORY, basename);
+ filename = getImg3(getCurrentLevelDir(), GRAPHICS_DIRECTORY, basename);
if (fileExists(filename))
return filename;
if (getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) != NULL)
{
/* 2nd try: look for special artwork configured in level series config */
- filename = getPath2(getLevelArtworkDir(ARTWORK_TYPE_GRAPHICS), basename);
+ filename = getImg2(getLevelArtworkDir(ARTWORK_TYPE_GRAPHICS), basename);
if (fileExists(filename))
return filename;
if (!skip_setup_artwork)
{
/* 3rd try: look for special artwork in configured artwork directory */
- filename = getPath2(getSetupArtworkDir(artwork.gfx_current), basename);
+ filename = getImg2(getSetupArtworkDir(artwork.gfx_current), basename);
if (fileExists(filename))
return filename;
}
/* 4th try: look for default artwork in new default artwork directory */
- filename = getPath2(getDefaultGraphicsDir(GFX_DEFAULT_SUBDIR), basename);
+ filename = getImg2(getDefaultGraphicsDir(GFX_DEFAULT_SUBDIR), basename);
if (fileExists(filename))
return filename;
free(filename);
/* 5th try: look for default artwork in old default artwork directory */
- filename = getPath2(options.graphics_directory, basename);
+ filename = getImg2(options.graphics_directory, basename);
if (fileExists(filename))
return filename;
/* 6th try: look for fallback artwork in old default artwork directory */
/* (needed to prevent errors when trying to access unused artwork files) */
- filename = getPath2(options.graphics_directory, GFX_FALLBACK_FILENAME);
+ filename = getImg2(options.graphics_directory, GFX_FALLBACK_FILENAME);
if (fileExists(filename))
return filename;
#endif