mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 09:32:34 +00:00
- Fixed a crash when showing information on things with empty sprite name
- Added support for custom PLAYPAL information from PK3 or Directory
This commit is contained in:
parent
6ce78a1eb4
commit
9fb910a03e
3 changed files with 63 additions and 26 deletions
|
@ -143,7 +143,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
spritename.Text = "";
|
||||
General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(ti.Sprite).GetBitmap());
|
||||
}
|
||||
else if(ti.Sprite.Length <= 8)
|
||||
else if((ti.Sprite.Length <= 8) && (ti.Sprite.Length > 0))
|
||||
{
|
||||
spritename.Text = ti.Sprite;
|
||||
General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(ti.Sprite).GetPreview());
|
||||
|
|
|
@ -84,13 +84,20 @@ namespace CodeImp.DoomBuilder.Data
|
|||
Stream data = wads[i].GetPatchData(pname);
|
||||
if(data != null) return data;
|
||||
}
|
||||
|
||||
// Find in patches directory
|
||||
string path = Path.Combine(PATCHES_DIR, Path.GetDirectoryName(pname));
|
||||
string filename = FindFirstFile(path, Path.GetFileName(pname), true);
|
||||
if((filename != null) && FileExists(filename))
|
||||
|
||||
try
|
||||
{
|
||||
return LoadFile(filename);
|
||||
// Find in patches directory
|
||||
string path = Path.Combine(PATCHES_DIR, Path.GetDirectoryName(pname));
|
||||
string filename = FindFirstFile(path, Path.GetFileName(pname), true);
|
||||
if((filename != null) && FileExists(filename))
|
||||
{
|
||||
return LoadFile(filename);
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
General.WriteLogLine("ERROR: " + e.GetType().Name + " while loading patch '" + pname + "' from directory: " + e.Message);
|
||||
}
|
||||
|
||||
// Nothing found
|
||||
|
@ -110,13 +117,20 @@ namespace CodeImp.DoomBuilder.Data
|
|||
Stream data = wads[i].GetTextureData(pname);
|
||||
if(data != null) return data;
|
||||
}
|
||||
|
||||
// Find in patches directory
|
||||
string path = Path.Combine(TEXTURES_DIR, Path.GetDirectoryName(pname));
|
||||
string filename = FindFirstFile(path, Path.GetFileName(pname), true);
|
||||
if((filename != null) && FileExists(filename))
|
||||
|
||||
try
|
||||
{
|
||||
return LoadFile(filename);
|
||||
// Find in patches directory
|
||||
string path = Path.Combine(TEXTURES_DIR, Path.GetDirectoryName(pname));
|
||||
string filename = FindFirstFile(path, Path.GetFileName(pname), true);
|
||||
if((filename != null) && FileExists(filename))
|
||||
{
|
||||
return LoadFile(filename);
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
General.WriteLogLine("ERROR: " + e.GetType().Name + " while loading texture '" + pname + "' from directory: " + e.Message);
|
||||
}
|
||||
|
||||
// Nothing found
|
||||
|
@ -139,15 +153,22 @@ namespace CodeImp.DoomBuilder.Data
|
|||
Stream sprite = wads[i].GetSpriteData(pname);
|
||||
if(sprite != null) return sprite;
|
||||
}
|
||||
|
||||
// Find in sprites directory
|
||||
string path = Path.Combine(SPRITES_DIR, Path.GetDirectoryName(pname));
|
||||
string filename = FindFirstFile(path, Path.GetFileName(pname), true);
|
||||
if((filename != null) && FileExists(filename))
|
||||
|
||||
try
|
||||
{
|
||||
return LoadFile(filename);
|
||||
// Find in sprites directory
|
||||
string path = Path.Combine(SPRITES_DIR, Path.GetDirectoryName(pname));
|
||||
string filename = FindFirstFile(path, Path.GetFileName(pname), true);
|
||||
if((filename != null) && FileExists(filename))
|
||||
{
|
||||
return LoadFile(filename);
|
||||
}
|
||||
}
|
||||
|
||||
catch(Exception e)
|
||||
{
|
||||
General.WriteLogLine("ERROR: " + e.GetType().Name + " while loading sprite '" + pname + "' from directory: " + e.Message);
|
||||
}
|
||||
|
||||
// Nothing found
|
||||
return null;
|
||||
}
|
||||
|
@ -165,13 +186,20 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
// Find in sprites directory
|
||||
string path = Path.Combine(SPRITES_DIR, Path.GetDirectoryName(pname));
|
||||
string filename = FindFirstFile(path, Path.GetFileName(pname), true);
|
||||
if((filename != null) && FileExists(filename))
|
||||
try
|
||||
{
|
||||
return true;
|
||||
string path = Path.Combine(SPRITES_DIR, Path.GetDirectoryName(pname));
|
||||
string filename = FindFirstFile(path, Path.GetFileName(pname), true);
|
||||
if((filename != null) && FileExists(filename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
catch(Exception e)
|
||||
{
|
||||
General.WriteLogLine("ERROR: " + e.GetType().Name + " while checking sprite '" + pname + "' existance in directory: " + e.Message);
|
||||
}
|
||||
|
||||
// Nothing found
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,16 @@ namespace CodeImp.DoomBuilder.Data
|
|||
foreach(WADReader wr in wads)
|
||||
{
|
||||
Playpal wadpalette = wr.LoadPalette();
|
||||
if(wadpalette != null) palette = wadpalette;
|
||||
if(wadpalette != null) return wadpalette;
|
||||
}
|
||||
|
||||
// Find in root directory
|
||||
string foundfile = FindFirstFile("PLAYPAL", false);
|
||||
if((foundfile != null) && FileExists(foundfile))
|
||||
{
|
||||
MemoryStream stream = LoadFile(foundfile);
|
||||
palette = new Playpal(stream);
|
||||
stream.Dispose();
|
||||
}
|
||||
|
||||
// Done
|
||||
|
|
Loading…
Reference in a new issue