GZDoom Builder 1.12b:

Things can now be rotated in visual mode.
Added JPG and TGA image format support.
Fixed: TEXTURES files with names other than "textures.ext" will now be loaded (as an example, files named like "textures.something.txt" or "textures_walls.ccp" will be loaded by (G)ZDoom, but not by Doom Builder 2 or previous versions of GZDB).
Fixed: textures defined in TEXTURES have higher priority in (G)ZDoom than images with the same name in "textures" folder.
Fixed another possible crash when MODELDEF is reloaded.
This commit is contained in:
MaxED 2012-08-05 19:18:05 +00:00
parent 4ac5162714
commit 508a3f2772
33 changed files with 506 additions and 338 deletions

View file

@ -192,6 +192,19 @@
<td><div align="center">Ctrl + Middle-Click</div></td> <td><div align="center">Ctrl + Middle-Click</div></td>
<td>Moves selected Things to cursor location preserving relative offsets in Visual Modes.</td> <td>Moves selected Things to cursor location preserving relative offsets in Visual Modes.</td>
</tr> </tr>
<tr>
<td>Rotate Selected Things Clockwise</td>
<td><div align="center">Ctrl-Shift-MScroll</div></td>
<td>Rotates selected things clockwise.</td>
</tr>
<tr>
<td>Rotate Selected Things Counterclockwise</td>
<td><div align="center">Ctrl-Shift-MScroll</div></td>
<td>Rotates selected things counterclockwise.</td>
</tr>
</table> </table>
</p> </p>
</div> </div>

View file

@ -7,10 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuilderModes", "..\Plugins\
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GZDoomEditing", "..\Plugins\GZDoomEditing\GZDoomEditing.csproj", "{760A9BC7-CB73-4C36-858B-994C14996FCD}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GZDoomEditing", "..\Plugins\GZDoomEditing\GZDoomEditing.csproj", "{760A9BC7-CB73-4C36-858B-994C14996FCD}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UDMFControls", "..\Plugins\UMDFControls\UDMFControls.csproj", "{2D11C828-295C-463A-8545-CA1AD6D51518}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TagExplorer", "..\Plugins\TagExplorer\TagExplorer.csproj", "{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -51,28 +47,6 @@ Global
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Mixed Platforms.Build.0 = Release|x86 {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Mixed Platforms.Build.0 = Release|x86
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.ActiveCfg = Release|x86 {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.ActiveCfg = Release|x86
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.Build.0 = Release|x86 {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.Build.0 = Release|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Mixed Platforms.Build.0 = Debug|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|x86.ActiveCfg = Debug|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|x86.Build.0 = Debug|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Any CPU.Build.0 = Release|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Mixed Platforms.ActiveCfg = Release|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Mixed Platforms.Build.0 = Release|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|x86.ActiveCfg = Release|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|x86.Build.0 = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Any CPU.ActiveCfg = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Mixed Platforms.Build.0 = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|x86.ActiveCfg = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|x86.Build.0 = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Any CPU.ActiveCfg = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Mixed Platforms.ActiveCfg = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Mixed Platforms.Build.0 = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x86.ActiveCfg = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x86.Build.0 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -1456,6 +1456,9 @@ namespace CodeImp.DoomBuilder.Data
foreach (KeyValuePair<int, ModeldefEntry> group in modeldefEntries) foreach (KeyValuePair<int, ModeldefEntry> group in modeldefEntries)
group.Value.Dispose(); group.Value.Dispose();
} }
foreach (Thing t in General.Map.Map.Things) t.IsModel = false; //drop model flag
General.MainWindow.DisplayStatus(StatusType.Busy, "Reloading model definitions..."); General.MainWindow.DisplayStatus(StatusType.Busy, "Reloading model definitions...");
loadModeldefs(createActorsByClassList()); loadModeldefs(createActorsByClassList());
LoadModels(); LoadModels();
@ -1504,6 +1507,8 @@ namespace CodeImp.DoomBuilder.Data
return; return;
} }
foreach(Thing t in General.Map.Map.Things) t.IsModel = false; //drop model flag
Dictionary<string, ModeldefEntry> modelDefEntriesByName = new Dictionary<string, ModeldefEntry>(); Dictionary<string, ModeldefEntry> modelDefEntriesByName = new Dictionary<string, ModeldefEntry>();
ModeldefParser mdeParser = new ModeldefParser(); ModeldefParser mdeParser = new ModeldefParser();

View file

@ -285,6 +285,11 @@ namespace CodeImp.DoomBuilder.Data
return files.GetAllFilesWithTitle(path, title, subfolders).ToArray(); return files.GetAllFilesWithTitle(path, title, subfolders).ToArray();
} }
//mxd. This returns all files in a given directory which title starts with given title
protected override string[] GetAllFilesWhichTitleStartsWith(string path, string title) {
return files.GetAllFilesWhichTitleStartsWith(path, title).ToArray();
}
// This returns all files in a given directory that match the given extension // This returns all files in a given directory that match the given extension
protected override string[] GetFilesWithExt(string path, string extension, bool subfolders) protected override string[] GetFilesWithExt(string path, string extension, bool subfolders)
{ {

View file

@ -46,7 +46,7 @@ namespace CodeImp.DoomBuilder.Data
{ {
// Initialize // Initialize
//this.filepathname = filepathname; //this.filepathname = filepathname;
this.fullName = filepathname; this.fullName = filepathname; //mxd
SetName(name); SetName(name);
if(asflat) if(asflat)
@ -70,7 +70,7 @@ namespace CodeImp.DoomBuilder.Data
public FileImage(string name, string filepathname, bool asflat, float scalex, float scaley) public FileImage(string name, string filepathname, bool asflat, float scalex, float scaley)
{ {
// Initialize // Initialize
this.fullName = filepathname; this.fullName = filepathname; //mxd
this.scale.x = scalex; this.scale.x = scalex;
this.scale.y = scaley; this.scale.y = scaley;
SetName(name); SetName(name);

View file

@ -54,8 +54,7 @@ namespace CodeImp.DoomBuilder.Data
protected Vector2D scale; protected Vector2D scale;
protected bool worldpanning; protected bool worldpanning;
protected bool usecolorcorrection; protected bool usecolorcorrection;
//mxd protected string fullName; //mxd. name with path;
protected string fullName; //name with path;
// Loading // Loading
private volatile ImageLoadState previewstate; private volatile ImageLoadState previewstate;

View file

@ -40,22 +40,15 @@ namespace CodeImp.DoomBuilder.Data
// File format signatures // File format signatures
private static readonly int[] PNG_SIGNATURE = new int[] { 137, 80, 78, 71, 13, 10, 26, 10 }; private static readonly int[] PNG_SIGNATURE = new int[] { 137, 80, 78, 71, 13, 10, 26, 10 };
private static readonly int[] GIF_SIGNATURE = new int[] { 71, 73, 70 }; private static readonly int[] GIF_SIGNATURE = new int[] { 71, 73, 70 };
//private static readonly int[] BMP_SIGNATURE = new int[] { 66, 77 }; //mxd. Not supported in (G)ZDoom private static readonly int[] BMP_SIGNATURE = new int[] { 66, 77 };
private static readonly int[] DDS_SIGNATURE = new int[] { 68, 68, 83, 32 }; private static readonly int[] DDS_SIGNATURE = new int[] { 68, 68, 83, 32 };
//mxd private static readonly int[] JPG_SIGNATURE = new int[] { 255, 216, 255, 224 }; //mxd
private static readonly int[] PCX_SIGNATURE = new int[] { 10, 5, 1, 8 }; private static readonly int[] TGA_SIGNATURE = new int[] { 0, 0, 2, 0 }; //mxd
//char Manufacturer; // 10 = ZSoft .PCX private static readonly int[] PCX_SIGNATURE = new int[] { 10, 5, 1, 8 }; //mxd
//char Version; // 0 = Version 2.5
// 2 = Version 2.8 with palette info
// 3 = Version 2.8 without palette info
// 5 = Version 3.0
//char Encoding; // 1 = .PCX encoding
//char BitsPerLayer; // bpp
// This check image data and returns the appropriate image reader // This check image data and returns the appropriate image reader
public static IImageReader GetImageReader(Stream data, int guessformat, Playpal palette) public static IImageReader GetImageReader(Stream data, int guessformat, Playpal palette)
{ {
//BinaryReader bindata = new BinaryReader(data);
DoomPictureReader picreader; DoomPictureReader picreader;
DoomFlatReader flatreader; DoomFlatReader flatreader;
DoomColormapReader colormapreader; DoomColormapReader colormapreader;
@ -68,27 +61,31 @@ namespace CodeImp.DoomBuilder.Data
{ {
// Check for PNG signature // Check for PNG signature
data.Seek(0, SeekOrigin.Begin); data.Seek(0, SeekOrigin.Begin);
if(CheckSignature(data, PNG_SIGNATURE)) return new FileImageReader(); if(CheckSignature(data, PNG_SIGNATURE)) return new FileImageReader(DevilImageType.IL_PNG);
// Check for DDS signature // Check for DDS signature
data.Seek(0, SeekOrigin.Begin); data.Seek(0, SeekOrigin.Begin);
if(CheckSignature(data, DDS_SIGNATURE)) return new FileImageReader(); if (CheckSignature(data, DDS_SIGNATURE)) return new FileImageReader(DevilImageType.IL_DDS);
// Check for GIF signature // Check for GIF signature
data.Seek(0, SeekOrigin.Begin); data.Seek(0, SeekOrigin.Begin);
if(CheckSignature(data, GIF_SIGNATURE)) return new FileImageReader(); if (CheckSignature(data, GIF_SIGNATURE)) return new FileImageReader(DevilImageType.IL_GIF);
//mxd. Check for PCX signature //mxd. Check for PCX signature
data.Seek(0, SeekOrigin.Begin); data.Seek(0, SeekOrigin.Begin);
if (CheckSignature(data, PCX_SIGNATURE)) return new FileImageReader(); if (CheckSignature(data, PCX_SIGNATURE)) return new FileImageReader(DevilImageType.IL_PCX);
//mxd. Check for JPG signature
data.Seek(0, SeekOrigin.Begin);
if (CheckSignature(data, JPG_SIGNATURE)) return new FileImageReader(DevilImageType.IL_JPG);
//mxd. Check for TGA signature
data.Seek(0, SeekOrigin.Begin);
if (CheckSignature(data, TGA_SIGNATURE)) return new FileImageReader(DevilImageType.IL_TGA);
// Check for BMP signature // Check for BMP signature
/*data.Seek(0, SeekOrigin.Begin); data.Seek(0, SeekOrigin.Begin);
if(CheckSignature(data, BMP_SIGNATURE)) if (CheckSignature(data, BMP_SIGNATURE)) return new UnknownImageReader(); //mxd. Not supported in (G)ZDoom
{
// Check if data size matches the size specified in the data
if(bindata.ReadUInt32() <= data.Length) return new FileImageReader();
}*/
} }
// Could it be a doom picture? // Could it be a doom picture?

View file

@ -291,6 +291,11 @@ namespace CodeImp.DoomBuilder.Data
return files.GetAllFilesWithTitle(path, title, subfolders).ToArray(); return files.GetAllFilesWithTitle(path, title, subfolders).ToArray();
} }
//mxd. This returns all files in a given directory which title starts with given title
protected override string[] GetAllFilesWhichTitleStartsWith(string path, string title) {
return files.GetAllFilesWhichTitleStartsWith(path, title).ToArray();
}
// This returns all files in a given directory that match the given extension // This returns all files in a given directory that match the given extension
protected override string[] GetFilesWithExt(string path, string extension, bool subfolders) protected override string[] GetFilesWithExt(string path, string extension, bool subfolders)
{ {

View file

@ -181,9 +181,10 @@ namespace CodeImp.DoomBuilder.Data
AddImagesToList(images, collection); AddImagesToList(images, collection);
} }
//mxd
// Add images from texture directory // Add images from texture directory
collection = LoadDirectoryImages(TEXTURES_DIR, ImageDataFormat.DOOMPICTURE, true); //collection = LoadDirectoryImages(TEXTURES_DIR, ImageDataFormat.DOOMPICTURE, true);
AddImagesToList(images, collection); //AddImagesToList(images, collection);
// Load TEXTURE1 lump file // Load TEXTURE1 lump file
imgset.Clear(); imgset.Clear();
@ -207,9 +208,10 @@ namespace CodeImp.DoomBuilder.Data
// Add images from TEXTURE1 and TEXTURE2 lump files // Add images from TEXTURE1 and TEXTURE2 lump files
AddImagesToList(images, imgset); AddImagesToList(images, imgset);
// Load TEXTURES lump file // Load TEXTURES lump files
imgset.Clear(); imgset.Clear();
string[] alltexturefiles = GetAllFilesWithTitle("", "TEXTURES", false); //string[] alltexturefiles = GetAllFilesWithTitle("", "TEXTURES", false);
string[] alltexturefiles = GetAllFilesWhichTitleStartsWith("", "TEXTURES"); //mxd
foreach(string texturesfile in alltexturefiles) foreach(string texturesfile in alltexturefiles)
{ {
MemoryStream filedata = LoadFile(texturesfile); MemoryStream filedata = LoadFile(texturesfile);
@ -220,6 +222,10 @@ namespace CodeImp.DoomBuilder.Data
// Add images from TEXTURES lump file // Add images from TEXTURES lump file
AddImagesToList(images, imgset); AddImagesToList(images, imgset);
//mxd. Add images from texture directory. Textures defined in TEXTURES override ones in "textures" folder
collection = LoadDirectoryImages(TEXTURES_DIR, ImageDataFormat.DOOMPICTURE, true);
AddImagesToList(images, collection);
// Add images to the container-specific texture set // Add images to the container-specific texture set
foreach(ImageData img in images.Values) foreach(ImageData img in images.Values)
textureset.AddTexture(img); textureset.AddTexture(img);
@ -579,6 +585,9 @@ namespace CodeImp.DoomBuilder.Data
// This must return all files in a given directory that have the given file title // This must return all files in a given directory that have the given file title
protected abstract string[] GetAllFilesWithTitle(string path, string title, bool subfolders); protected abstract string[] GetAllFilesWithTitle(string path, string title, bool subfolders);
//mxd. This must return all files in a given directory which title starts with given title
protected abstract string[] GetAllFilesWhichTitleStartsWith(string path, string title);
// This must return all files in a given directory that match the given extension // This must return all files in a given directory that match the given extension
protected abstract string[] GetFilesWithExt(string path, string extension, bool subfolders); protected abstract string[] GetFilesWithExt(string path, string extension, bool subfolders);

View file

@ -551,7 +551,9 @@ namespace CodeImp.DoomBuilder.Data
{ {
// Find the lump anywhere // Find the lump anywhere
lump = file.FindLump(pname); lump = file.FindLump(pname);
if(lump != null) return lump.Stream; if (lump != null) {
return lump.Stream;
}
} }
return null; return null;

View file

@ -33,7 +33,7 @@ namespace CodeImp.DoomBuilder.GZBuilder
//version //version
public const float Version = 1.12f; public const float Version = 1.12f;
public const char Revision = 'a'; public const char Revision = 'b';
//debug console //debug console
#if DEBUG #if DEBUG

View file

@ -167,6 +167,17 @@ namespace CodeImp.DoomBuilder.IO
} }
} }
//mxd. This returns a list of all files that are in the given path and which names starts with title
public List<string> GetAllFilesWhichTitleStartsWith(string path, string title) {
path = CorrectPath(path).ToLowerInvariant();
title = title.ToLowerInvariant();
List<string> files = new List<string>(entries.Length);
for (int i = 0; i < entries.Length; i++)
if ((entries[i].path == path) && (entries[i].filetitle.StartsWith(title)))
files.Add(entries[i].filepathname);
return files;
}
// This returns a list of all files that are in the given path and subdirectories and have the given extension // This returns a list of all files that are in the given path and subdirectories and have the given extension
public List<string> GetAllFiles(string path, string extension) public List<string> GetAllFiles(string path, string extension)
{ {

View file

@ -39,6 +39,7 @@ namespace CodeImp.DoomBuilder.IO
// Palette to use // Palette to use
private Playpal palette; private Playpal palette;
public uint ImageType { get; private set; } //mxd
#endregion #endregion
@ -49,6 +50,7 @@ namespace CodeImp.DoomBuilder.IO
{ {
// Initialize // Initialize
this.palette = palette; this.palette = palette;
ImageType = DevilImageType.IL_TYPE_UNKNOWN; //mxd
// We have no destructor // We have no destructor
GC.SuppressFinalize(this); GC.SuppressFinalize(this);

View file

@ -39,6 +39,7 @@ namespace CodeImp.DoomBuilder.IO
// Palette to use // Palette to use
private Playpal palette; private Playpal palette;
public uint ImageType { get; private set; } //mxd
#endregion #endregion
@ -49,6 +50,7 @@ namespace CodeImp.DoomBuilder.IO
{ {
// Initialize // Initialize
this.palette = palette; this.palette = palette;
ImageType = DevilImageType.IL_TYPE_UNKNOWN;//mxd
// We have no destructor // We have no destructor
GC.SuppressFinalize(this); GC.SuppressFinalize(this);

View file

@ -39,6 +39,7 @@ namespace CodeImp.DoomBuilder.IO
// Palette to use // Palette to use
private Playpal palette; private Playpal palette;
public uint ImageType { get; private set; } //mxd
#endregion #endregion
@ -49,6 +50,7 @@ namespace CodeImp.DoomBuilder.IO
{ {
// Initialize // Initialize
this.palette = palette; this.palette = palette;
ImageType = DevilImageType.IL_TYPE_UNKNOWN; //mxd
// We have no destructor // We have no destructor
GC.SuppressFinalize(this); GC.SuppressFinalize(this);

View file

@ -34,6 +34,21 @@ using System.Drawing.Imaging;
namespace CodeImp.DoomBuilder.IO namespace CodeImp.DoomBuilder.IO
{ {
//mxd
internal struct DevilImageType
{
internal const int IL_TYPE_UNKNOWN = 0x0000;
//internal const int IL_DOOM = 0x0422; //!< DooM walls - no specific extension
//internal const int IL_DOOM_FLAT = 0x0423; //!< DooM flats - no specific extension
internal const int IL_JPG = 0x0425; //!< JPEG - .jpg, .jpe and .jpeg extensions
internal const int IL_PCX = 0x0428; //!< ZSoft PCX - .pcx extension
internal const int IL_PNG = 0x042A; //!< Portable Network Graphics - .png extension
internal const int IL_TGA = 0x042D; //!< TrueVision Targa File - .tga, .vda, .icb and .vst extensions
internal const int IL_GIF = 0x0436; //!< Graphics Interchange Format - .gif extension
internal const int IL_DDS = 0x0437; //!< DirectDraw Surface - .dds extension
}
internal unsafe class FileImageReader : IImageReader internal unsafe class FileImageReader : IImageReader
{ {
#region ================== APIs #region ================== APIs
@ -59,32 +74,33 @@ namespace CodeImp.DoomBuilder.IO
[DllImport("devil.dll")] [DllImport("devil.dll")]
private static extern uint ilCopyPixels(uint xoff, uint yoff, uint zoff, uint width, uint height, uint depth, uint format, uint type, IntPtr data); private static extern uint ilCopyPixels(uint xoff, uint yoff, uint zoff, uint width, uint height, uint depth, uint format, uint type, IntPtr data);
//mxd. Look's like we don't need many of those...
// Matches OpenGL's right now. // Matches OpenGL's right now.
//! Data formats \link Formats Formats\endlink //! Data formats \link Formats Formats\endlink
private const int IL_COLOUR_INDEX = 0x1900; //private const int IL_COLOUR_INDEX = 0x1900;
private const int IL_COLOR_INDEX = 0x1900; //private const int IL_COLOR_INDEX = 0x1900;
private const int IL_ALPHA = 0x1906; //private const int IL_ALPHA = 0x1906;
private const int IL_RGB = 0x1907; //private const int IL_RGB = 0x1907;
private const int IL_RGBA = 0x1908; //private const int IL_RGBA = 0x1908;
private const int IL_BGR = 0x80E0; //private const int IL_BGR = 0x80E0;
private const int IL_BGRA = 0x80E1; private const int IL_BGRA = 0x80E1;
private const int IL_LUMINANCE = 0x1909; //private const int IL_LUMINANCE = 0x1909;
private const int IL_LUMINANCE_ALPHA = 0x190A; //private const int IL_LUMINANCE_ALPHA = 0x190A;
//! Data types \link Types Types\endlink //! Data types \link Types Types\endlink
private const int IL_BYTE = 0x1400; //private const int IL_BYTE = 0x1400;
private const int IL_UNSIGNED_BYTE = 0x1401; private const int IL_UNSIGNED_BYTE = 0x1401;
private const int IL_SHORT = 0x1402; /*private const int IL_SHORT = 0x1402;
private const int IL_UNSIGNED_SHORT = 0x1403; private const int IL_UNSIGNED_SHORT = 0x1403;
private const int IL_INT = 0x1404; private const int IL_INT = 0x1404;
private const int IL_UNSIGNED_INT = 0x1405; private const int IL_UNSIGNED_INT = 0x1405;
private const int IL_FLOAT = 0x1406; private const int IL_FLOAT = 0x1406;
private const int IL_DOUBLE = 0x140A; private const int IL_DOUBLE = 0x140A;
private const int IL_HALF = 0x140B; private const int IL_HALF = 0x140B;*/
// Image types // Image types
private const int IL_TYPE_UNKNOWN = 0x0000; //private const int IL_TYPE_UNKNOWN = 0x0000;
private const int IL_BMP = 0x0420; //!< Microsoft Windows Bitmap - .bmp extension /*private const int IL_BMP = 0x0420; //!< Microsoft Windows Bitmap - .bmp extension
private const int IL_CUT = 0x0421; //!< Dr. Halo - .cut extension private const int IL_CUT = 0x0421; //!< Dr. Halo - .cut extension
private const int IL_DOOM = 0x0422; //!< DooM walls - no specific extension private const int IL_DOOM = 0x0422; //!< DooM walls - no specific extension
private const int IL_DOOM_FLAT = 0x0423; //!< DooM flats - no specific extension private const int IL_DOOM_FLAT = 0x0423; //!< DooM flats - no specific extension
@ -135,14 +151,13 @@ namespace CodeImp.DoomBuilder.IO
private const int IL_TEXTURE = 0x044F; //!< Medieval II: Total War Texture - .texture extension private const int IL_TEXTURE = 0x044F; //!< Medieval II: Total War Texture - .texture extension
private const int IL_DPX = 0x0450; //!< Digital Picture Exchange - .dpx extension private const int IL_DPX = 0x0450; //!< Digital Picture Exchange - .dpx extension
private const int IL_UTX = 0x0451; //!< Unreal (and Unreal Tournament) Texture - .utx extension private const int IL_UTX = 0x0451; //!< Unreal (and Unreal Tournament) Texture - .utx extension
private const int IL_MP3 = 0x0452; //!< MPEG-1 Audio Layer 3 - .mp3 extension private const int IL_MP3 = 0x0452; //!< MPEG-1 Audio Layer 3 - .mp3 extension*/
private const int IL_JASC_PAL = 0x0475; //!< PaintShop Pro Palette private const int IL_JASC_PAL = 0x0475; //!< PaintShop Pro Palette
// Error Types // Error Types
private const int IL_NO_ERROR = 0x0000; /*private const int IL_NO_ERROR = 0x0000;
private const int IL_INVALID_ENUM = 0x0501; private const int IL_INVALID_ENUM = 0x0501;
private const int IL_OUT_OF_MEMORY = 0x0502; private const int IL_OUT_OF_MEMORY = 0x0502;
private const int IL_FORMAT_NOT_SUPPORTED = 0x0503; private const int IL_FORMAT_NOT_SUPPORTED = 0x0503;
@ -161,96 +176,96 @@ namespace CodeImp.DoomBuilder.IO
private const int IL_INVALID_CONVERSION = 0x0510; private const int IL_INVALID_CONVERSION = 0x0510;
private const int IL_BAD_DIMENSIONS = 0x0511; private const int IL_BAD_DIMENSIONS = 0x0511;
private const int IL_FILE_READ_ERROR = 0x0512; // 05/12/2002: Addition by Sam. private const int IL_FILE_READ_ERROR = 0x0512; // 05/12/2002: Addition by Sam.
private const int IL_FILE_WRITE_ERROR = 0x0512; private const int IL_FILE_WRITE_ERROR = 0x0512;*/
private const int IL_LIB_GIF_ERROR = 0x05E1; /*private const int IL_LIB_GIF_ERROR = 0x05E1;
private const int IL_LIB_JPEG_ERROR = 0x05E2; private const int IL_LIB_JPEG_ERROR = 0x05E2;
private const int IL_LIB_PNG_ERROR = 0x05E3; private const int IL_LIB_PNG_ERROR = 0x05E3;
private const int IL_LIB_TIFF_ERROR = 0x05E4; private const int IL_LIB_TIFF_ERROR = 0x05E4;
private const int IL_LIB_MNG_ERROR = 0x05E5; private const int IL_LIB_MNG_ERROR = 0x05E5;
private const int IL_LIB_JP2_ERROR = 0x05E6; private const int IL_LIB_JP2_ERROR = 0x05E6;
private const int IL_LIB_EXR_ERROR = 0x05E7; private const int IL_LIB_EXR_ERROR = 0x05E7;
private const int IL_UNKNOWN_ERROR = 0x05FF; private const int IL_UNKNOWN_ERROR = 0x05FF;*/
// Origin Definitions // Origin Definitions
private const int IL_ORIGIN_SET = 0x0600; /*private const int IL_ORIGIN_SET = 0x0600;
private const int IL_ORIGIN_LOWER_LEFT = 0x0601; private const int IL_ORIGIN_LOWER_LEFT = 0x0601;
private const int IL_ORIGIN_UPPER_LEFT = 0x0602; private const int IL_ORIGIN_UPPER_LEFT = 0x0602;
private const int IL_ORIGIN_MODE = 0x0603; private const int IL_ORIGIN_MODE = 0x0603;*/
// Format and Type Mode Definitions // Format and Type Mode Definitions
private const int IL_FORMAT_SET = 0x0610; /*private const int IL_FORMAT_SET = 0x0610;
private const int IL_FORMAT_MODE = 0x0611; private const int IL_FORMAT_MODE = 0x0611;
private const int IL_TYPE_SET = 0x0612; private const int IL_TYPE_SET = 0x0612;
private const int IL_TYPE_MODE = 0x0613; private const int IL_TYPE_MODE = 0x0613;*/
// File definitions // File definitions
private const int IL_FILE_OVERWRITE = 0x0620; /*private const int IL_FILE_OVERWRITE = 0x0620;
private const int IL_FILE_MODE = 0x0621; private const int IL_FILE_MODE = 0x0621;
*/
// Palette definitions // Palette definitions
private const int IL_CONV_PAL = 0x0630; //private const int IL_CONV_PAL = 0x0630;
// Load fail definitions // Load fail definitions
private const int IL_DEFAULT_ON_FAIL = 0x0632; //private const int IL_DEFAULT_ON_FAIL = 0x0632;
// Key colour and alpha definitions // Key colour and alpha definitions
private const int IL_USE_KEY_COLOUR = 0x0635; /*private const int IL_USE_KEY_COLOUR = 0x0635;
private const int IL_USE_KEY_COLOR = 0x0635; private const int IL_USE_KEY_COLOR = 0x0635;
private const int IL_BLIT_BLEND = 0x0636; private const int IL_BLIT_BLEND = 0x0636;*/
// Interlace definitions // Interlace definitions
private const int IL_SAVE_INTERLACED = 0x0639; /*private const int IL_SAVE_INTERLACED = 0x0639;
private const int IL_INTERLACE_MODE = 0x063A; private const int IL_INTERLACE_MODE = 0x063A;*/
// Quantization definitions // Quantization definitions
private const int IL_QUANTIZATION_MODE = 0x0640; /*private const int IL_QUANTIZATION_MODE = 0x0640;
private const int IL_WU_QUANT = 0x0641; private const int IL_WU_QUANT = 0x0641;
private const int IL_NEU_QUANT = 0x0642; private const int IL_NEU_QUANT = 0x0642;
private const int IL_NEU_QUANT_SAMPLE = 0x0643; private const int IL_NEU_QUANT_SAMPLE = 0x0643;
private const int IL_MAX_QUANT_INDEXS = 0x0644; //XIX : ILint : Maximum number of colors to reduce to, default of 256. and has a range of 2-256 private const int IL_MAX_QUANT_INDEXS = 0x0644; //XIX : ILint : Maximum number of colors to reduce to, default of 256. and has a range of 2-256
private const int IL_MAX_QUANT_INDICES = 0x0644; // Redefined, since the above private const int is misspelled private const int IL_MAX_QUANT_INDICES = 0x0644; // Redefined, since the above private const int is misspelled*/
// Hints // Hints
private const int IL_FASTEST = 0x0660; /*private const int IL_FASTEST = 0x0660;
private const int IL_LESS_MEM = 0x0661; private const int IL_LESS_MEM = 0x0661;
private const int IL_DONT_CARE = 0x0662; private const int IL_DONT_CARE = 0x0662;
private const int IL_MEM_SPEED_HINT = 0x0665; private const int IL_MEM_SPEED_HINT = 0x0665;
private const int IL_USE_COMPRESSION = 0x0666; private const int IL_USE_COMPRESSION = 0x0666;
private const int IL_NO_COMPRESSION = 0x0667; private const int IL_NO_COMPRESSION = 0x0667;
private const int IL_COMPRESSION_HINT = 0x0668; private const int IL_COMPRESSION_HINT = 0x0668;*/
// Compression // Compression
private const int IL_NVIDIA_COMPRESS = 0x0670; /*private const int IL_NVIDIA_COMPRESS = 0x0670;
private const int IL_SQUISH_COMPRESS = 0x0671; private const int IL_SQUISH_COMPRESS = 0x0671;*/
// Subimage types // Subimage types
private const int IL_SUB_NEXT = 0x0680; /*private const int IL_SUB_NEXT = 0x0680;
private const int IL_SUB_MIPMAP = 0x0681; private const int IL_SUB_MIPMAP = 0x0681;
private const int IL_SUB_LAYER = 0x0682; private const int IL_SUB_LAYER = 0x0682;*/
// Compression definitions // Compression definitions
private const int IL_COMPRESS_MODE = 0x0700; /*private const int IL_COMPRESS_MODE = 0x0700;
private const int IL_COMPRESS_NONE = 0x0701; private const int IL_COMPRESS_NONE = 0x0701;
private const int IL_COMPRESS_RLE = 0x0702; private const int IL_COMPRESS_RLE = 0x0702;
private const int IL_COMPRESS_LZO = 0x0703; private const int IL_COMPRESS_LZO = 0x0703;
private const int IL_COMPRESS_ZLIB = 0x0704; private const int IL_COMPRESS_ZLIB = 0x0704;*/
// File format-specific values // File format-specific values
private const int IL_TGA_CREATE_STAMP = 0x0710; /*private const int IL_TGA_CREATE_STAMP = 0x0710;
private const int IL_JPG_QUALITY = 0x0711; private const int IL_JPG_QUALITY = 0x0711;
private const int IL_PNG_INTERLACE = 0x0712; private const int IL_PNG_INTERLACE = 0x0712;
private const int IL_TGA_RLE = 0x0713; private const int IL_TGA_RLE = 0x0713;
@ -271,11 +286,11 @@ namespace CodeImp.DoomBuilder.IO
private const int IL_PCD_PICNUM = 0x0723; private const int IL_PCD_PICNUM = 0x0723;
private const int IL_PNG_ALPHA_INDEX = 0x0724; //XIX : ILint : the color in the palette at this index value (0-255) is considered transparent, -1 for no trasparent color private const int IL_PNG_ALPHA_INDEX = 0x0724; //XIX : ILint : the color in the palette at this index value (0-255) is considered transparent, -1 for no trasparent color
private const int IL_JPG_PROGRESSIVE = 0x0725; private const int IL_JPG_PROGRESSIVE = 0x0725;
private const int IL_VTF_COMP = 0x0726; private const int IL_VTF_COMP = 0x0726;*/
// DXTC definitions // DXTC definitions
private const int IL_DXTC_FORMAT = 0x0705; /*private const int IL_DXTC_FORMAT = 0x0705;
private const int IL_DXT1 = 0x0706; private const int IL_DXT1 = 0x0706;
private const int IL_DXT2 = 0x0707; private const int IL_DXT2 = 0x0707;
private const int IL_DXT3 = 0x0708; private const int IL_DXT3 = 0x0708;
@ -287,23 +302,23 @@ namespace CodeImp.DoomBuilder.IO
private const int IL_3DC = 0x070E; private const int IL_3DC = 0x070E;
private const int IL_RXGB = 0x070F; private const int IL_RXGB = 0x070F;
private const int IL_ATI1N = 0x0710; private const int IL_ATI1N = 0x0710;
private const int IL_DXT1A = 0x0711; // Normally the same as IL_DXT1, except for nVidia Texture Tools. private const int IL_DXT1A = 0x0711; // Normally the same as IL_DXT1, except for nVidia Texture Tools.*/
// Environment map definitions // Environment map definitions
private const int IL_CUBEMAP_POSITIVEX = 0x00000400; /*private const int IL_CUBEMAP_POSITIVEX = 0x00000400;
private const int IL_CUBEMAP_NEGATIVEX = 0x00000800; private const int IL_CUBEMAP_NEGATIVEX = 0x00000800;
private const int IL_CUBEMAP_POSITIVEY = 0x00001000; private const int IL_CUBEMAP_POSITIVEY = 0x00001000;
private const int IL_CUBEMAP_NEGATIVEY = 0x00002000; private const int IL_CUBEMAP_NEGATIVEY = 0x00002000;
private const int IL_CUBEMAP_POSITIVEZ = 0x00004000; private const int IL_CUBEMAP_POSITIVEZ = 0x00004000;
private const int IL_CUBEMAP_NEGATIVEZ = 0x00008000; private const int IL_CUBEMAP_NEGATIVEZ = 0x00008000;
private const int IL_SPHEREMAP = 0x00010000; private const int IL_SPHEREMAP = 0x00010000;*/
// Values // Values
private const int IL_VERSION_NUM = 0x0DE2; //private const int IL_VERSION_NUM = 0x0DE2;
private const int IL_IMAGE_WIDTH = 0x0DE4; private const int IL_IMAGE_WIDTH = 0x0DE4;
private const int IL_IMAGE_HEIGHT = 0x0DE5; private const int IL_IMAGE_HEIGHT = 0x0DE5;
private const int IL_IMAGE_DEPTH = 0x0DE6; /*private const int IL_IMAGE_DEPTH = 0x0DE6;
private const int IL_IMAGE_SIZE_OF_DATA = 0x0DE7; private const int IL_IMAGE_SIZE_OF_DATA = 0x0DE7;
private const int IL_IMAGE_BPP = 0x0DE8; private const int IL_IMAGE_BPP = 0x0DE8;
private const int IL_IMAGE_BYTES_PER_PIXEL = 0x0DE8; private const int IL_IMAGE_BYTES_PER_PIXEL = 0x0DE8;
@ -331,7 +346,10 @@ namespace CodeImp.DoomBuilder.IO
private const int IL_IMAGE_OFFY = 0x0DFC; private const int IL_IMAGE_OFFY = 0x0DFC;
private const int IL_IMAGE_CUBEFLAGS = 0x0DFD; private const int IL_IMAGE_CUBEFLAGS = 0x0DFD;
private const int IL_IMAGE_ORIGIN = 0x0DFE; private const int IL_IMAGE_ORIGIN = 0x0DFE;
private const int IL_IMAGE_CHANNELS = 0x0DFF; private const int IL_IMAGE_CHANNELS = 0x0DFF;*/
//mxd
public uint ImageType { get; private set; }
#endregion #endregion
@ -340,6 +358,16 @@ namespace CodeImp.DoomBuilder.IO
// Constructor // Constructor
public FileImageReader() public FileImageReader()
{ {
ImageType = DevilImageType.IL_TYPE_UNKNOWN;//mxd
// We have no destructor
GC.SuppressFinalize(this);
}
//mxd
public FileImageReader(uint devilImageType) {
ImageType = devilImageType;//mxd
// We have no destructor // We have no destructor
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
@ -357,6 +385,7 @@ namespace CodeImp.DoomBuilder.IO
return ReadAsBitmap(stream); return ReadAsBitmap(stream);
} }
// This reads the image and returns a Bitmap // This reads the image and returns a Bitmap
public Bitmap ReadAsBitmap(Stream stream) public Bitmap ReadAsBitmap(Stream stream)
{ {
@ -372,7 +401,7 @@ namespace CodeImp.DoomBuilder.IO
stream.Read(bytes, 0, bytes.Length); stream.Read(bytes, 0, bytes.Length);
fixed(byte* bptr = bytes) fixed(byte* bptr = bytes)
{ {
if(!ilLoadL(IL_TYPE_UNKNOWN, new IntPtr(bptr), (uint)bytes.Length)) if (!ilLoadL(ImageType, new IntPtr(bptr), (uint)bytes.Length))
throw new BadImageFormatException(); throw new BadImageFormatException();
} }
@ -394,6 +423,10 @@ namespace CodeImp.DoomBuilder.IO
// Clean up // Clean up
ilDeleteImages(1, new IntPtr(&imageid)); ilDeleteImages(1, new IntPtr(&imageid));
//mxd. TGA fix
if (ImageType == DevilImageType.IL_TGA)
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
return bmp; return bmp;
} }
catch(Exception e) catch(Exception e)

View file

@ -35,6 +35,9 @@ namespace CodeImp.DoomBuilder.IO
{ {
internal unsafe interface IImageReader internal unsafe interface IImageReader
{ {
//mxd. Variables
uint ImageType { get; } //holds Devil library Image type
// Methods // Methods
Bitmap ReadAsBitmap(Stream stream); Bitmap ReadAsBitmap(Stream stream);
Bitmap ReadAsBitmap(Stream stream, out int offsetx, out int offsety); Bitmap ReadAsBitmap(Stream stream, out int offsetx, out int offsety);

View file

@ -35,11 +35,14 @@ namespace CodeImp.DoomBuilder.IO
{ {
internal unsafe class UnknownImageReader : IImageReader internal unsafe class UnknownImageReader : IImageReader
{ {
public uint ImageType { get; private set; } //mxd
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
// Constructor // Constructor
public UnknownImageReader() public UnknownImageReader()
{ {
ImageType = DevilImageType.IL_TYPE_UNKNOWN;//mxd
// We have no destructor // We have no destructor
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }

View file

@ -150,8 +150,7 @@ namespace CodeImp.DoomBuilder.Rendering
public int VertexSize { get { return vertexsize; } } public int VertexSize { get { return vertexsize; } }
public ViewMode ViewMode { get { return viewmode; } } public ViewMode ViewMode { get { return viewmode; } }
public SurfaceManager Surfaces { get { return surfaces; } } public SurfaceManager Surfaces { get { return surfaces; } }
//mxd public RectangleF Viewport { get { return viewport; } } //mxd
public RectangleF Viewport { get { return viewport; } }
#endregion #endregion

View file

@ -527,7 +527,8 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Shaders.World3D.Begin(); graphics.Shaders.World3D.Begin();
// SOLID PASS // SOLID PASS
world = Matrix.Identity; //world = Matrix.Identity;
world = Matrix.Scaling(new Vector3(1.0f, 1.0f, 1.2f)); //mxd. GZDoom vertical scale hack
ApplyMatrices3D(); ApplyMatrices3D();
RenderSinglePass((int)RenderPass.Solid); RenderSinglePass((int)RenderPass.Solid);
@ -538,12 +539,14 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.CullMode, Cull.Counterclockwise); graphics.Device.SetRenderState(RenderState.CullMode, Cull.Counterclockwise);
// MASK PASS // MASK PASS
world = Matrix.Identity; //world = Matrix.Identity;
world = Matrix.Scaling(new Vector3(1.0f, 1.0f, 1.2f)); //mxd. GZDoom vertical scale hack
ApplyMatrices3D(); ApplyMatrices3D();
RenderSinglePass((int)RenderPass.Mask); RenderSinglePass((int)RenderPass.Mask);
// ALPHA PASS // ALPHA PASS
world = Matrix.Identity; //world = Matrix.Identity;
world = Matrix.Scaling(new Vector3(1.0f, 1.0f, 1.2f)); //mxd. GZDoom vertical scale hack
ApplyMatrices3D(); ApplyMatrices3D();
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true); graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false); graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
@ -556,14 +559,17 @@ namespace CodeImp.DoomBuilder.Rendering
if(renderthingcages) RenderThingCages(); if(renderthingcages) RenderThingCages();
// ADDITIVE PASS // ADDITIVE PASS
world = Matrix.Identity; //world = Matrix.Identity;
world = Matrix.Scaling(new Vector3(1.0f, 1.0f, 1.2f)); //mxd. GZDoom vertical scale hack
ApplyMatrices3D(); ApplyMatrices3D();
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.One); graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.One);
RenderSinglePass((int)RenderPass.Additive); RenderSinglePass((int)RenderPass.Additive);
//mxd. LIGHT PASS //mxd. LIGHT PASS
if (General.Settings.GZDrawLights && !fullbrightness && thingsWithLight.Count > 0 && litGeometry.Count > 0) if (General.Settings.GZDrawLights && !fullbrightness && thingsWithLight.Count > 0 && litGeometry.Count > 0) {
world = Matrix.Scaling(new Vector3(1.0f, 1.0f, 1.2f)); //mxd. GZDoom vertical scale hack
RenderLights(litGeometry, thingsWithLight); RenderLights(litGeometry, thingsWithLight);
}
// Remove references // Remove references
graphics.Shaders.World3D.Texture1 = null; graphics.Shaders.World3D.Texture1 = null;
@ -571,10 +577,6 @@ namespace CodeImp.DoomBuilder.Rendering
// Done // Done
graphics.Shaders.World3D.End(); graphics.Shaders.World3D.End();
geometry = null; geometry = null;
//dbg
//GZBuilder.GZGeneral.TraceLine("Affected by lights: "+totalGeo+"; skipped: "+geoSkipped+"; total things:"+totalThings);
//GZBuilder.GZGeneral.TraceInHeader("FPS:" + calculateFrameRate());
} }
//mxd //mxd
@ -743,10 +745,6 @@ namespace CodeImp.DoomBuilder.Rendering
} }
} }
//mxd. Scale everything to match GZDoom's wicked way of rendering
world = Matrix.Scaling(new Vector3(1.0f, 1.0f, 1.2f));
ApplyMatrices3D();
// Switch shader pass? // Switch shader pass?
if(currentshaderpass != wantedshaderpass) if(currentshaderpass != wantedshaderpass)
{ {
@ -927,7 +925,6 @@ namespace CodeImp.DoomBuilder.Rendering
if (lpr.W == 0) if (lpr.W == 0)
continue; continue;
graphics.Shaders.World3D.LightColor = lights[i].LightColor; graphics.Shaders.World3D.LightColor = lights[i].LightColor;
//graphics.Shaders.World3D.LightPositionAndRadius = lights[i].LightPositionAndRadius;
graphics.Shaders.World3D.LightPositionAndRadius = lpr; graphics.Shaders.World3D.LightPositionAndRadius = lpr;
graphics.Shaders.World3D.ApplySettings(); graphics.Shaders.World3D.ApplySettings();
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles); graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
@ -942,12 +939,10 @@ namespace CodeImp.DoomBuilder.Rendering
for (i = lightOffsets[0]; i < count; i++) { for (i = lightOffsets[0]; i < count; i++) {
if (checkBBoxIntersection(g.BoundingBox, lights[i].BoundingBox)) { if (checkBBoxIntersection(g.BoundingBox, lights[i].BoundingBox)) {
//lpr = lights[i].LightPositionAndRadius;
lpr = new Vector4(lights[i].Center, lights[i].LightRadius); lpr = new Vector4(lights[i].Center, lights[i].LightRadius);
if (lpr.W == 0) if (lpr.W == 0)
continue; continue;
graphics.Shaders.World3D.LightColor = lights[i].LightColor; graphics.Shaders.World3D.LightColor = lights[i].LightColor;
//graphics.Shaders.World3D.LightPositionAndRadius = lights[i].LightPositionAndRadius;
graphics.Shaders.World3D.LightPositionAndRadius = lpr; graphics.Shaders.World3D.LightPositionAndRadius = lpr;
graphics.Shaders.World3D.ApplySettings(); graphics.Shaders.World3D.ApplySettings();
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles); graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
@ -962,13 +957,11 @@ namespace CodeImp.DoomBuilder.Rendering
for (i = lightOffsets[0] + lightOffsets[1]; i < count; i++) { for (i = lightOffsets[0] + lightOffsets[1]; i < count; i++) {
if (checkBBoxIntersection(g.BoundingBox, lights[i].BoundingBox)) { if (checkBBoxIntersection(g.BoundingBox, lights[i].BoundingBox)) {
//lpr = lights[i].LightPositionAndRadius;
lpr = new Vector4(lights[i].Center, lights[i].LightRadius); lpr = new Vector4(lights[i].Center, lights[i].LightRadius);
if (lpr.W == 0) if (lpr.W == 0)
continue; continue;
Color4 lc = lights[i].LightColor; Color4 lc = lights[i].LightColor;
graphics.Shaders.World3D.LightColor = new Color4(lc.Alpha, (lc.Green + lc.Blue) / 2, (lc.Red + lc.Blue) / 2, (lc.Green + lc.Red) / 2); graphics.Shaders.World3D.LightColor = new Color4(lc.Alpha, (lc.Green + lc.Blue) / 2, (lc.Red + lc.Blue) / 2, (lc.Green + lc.Red) / 2);
//graphics.Shaders.World3D.LightPositionAndRadius = lights[i].LightPositionAndRadius;
graphics.Shaders.World3D.LightPositionAndRadius = lpr; graphics.Shaders.World3D.LightPositionAndRadius = lpr;
graphics.Shaders.World3D.ApplySettings(); graphics.Shaders.World3D.ApplySettings();
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles); graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
@ -980,9 +973,6 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Shaders.World3D.EndPass(); graphics.Shaders.World3D.EndPass();
graphics.Device.SetRenderState(RenderState.BlendOperation, BlendOperation.Add); graphics.Device.SetRenderState(RenderState.BlendOperation, BlendOperation.Add);
//dbg
//GZBuilder.GZGeneral.TraceLine("Lit " + gcount + " geometries; Lights: [" + lightOffsets[0] + ";" + lightOffsets[1] + ";" + lightOffsets[2] + "]" + Environment.NewLine + "Models count: " + thingsWithModel.Count);
} }
//mxd. render models //mxd. render models
@ -1033,7 +1023,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Create the matrix for positioning / rotation // Create the matrix for positioning / rotation
world = Matrix.Multiply(t.Orientation, Matrix.RotationZ(t.Thing.Angle)); world = Matrix.Multiply(t.Orientation, Matrix.RotationZ(t.Thing.Angle));
world = Matrix.Multiply(world, t.Position); world = Matrix.Multiply(world, t.ScaledPosition); //mxd. GZDoom vertical scale hack
ApplyMatrices3D(); ApplyMatrices3D();
//mxd. set variables for fog rendering //mxd. set variables for fog rendering
@ -1212,10 +1202,7 @@ namespace CodeImp.DoomBuilder.Rendering
Vector3D camNormal = Vector3D.FromAngleXYZ(General.Map.VisualCamera.AngleXY, General.Map.VisualCamera.AngleZ); Vector3D camNormal = Vector3D.FromAngleXYZ(General.Map.VisualCamera.AngleXY, General.Map.VisualCamera.AngleZ);
Vector3D thingNormal = D3DDevice.V3D(bbox[0]) - cameraposition; //bbox[0] is always thing center Vector3D thingNormal = D3DDevice.V3D(bbox[0]) - cameraposition; //bbox[0] is always thing center
if (Vector3D.DotProduct(camNormal, thingNormal) < 0) { //behind camera plane if (Vector3D.DotProduct(camNormal, thingNormal) < 0) return false; //behind camera plane
//GZBuilder.GZGeneral.Trace("Skipped geo. Vector3D.DotProduct(camNormal, thingNormal) < 0");
return false;
}
int len = bbox.Length; int len = bbox.Length;
Vector3 screenPos; Vector3 screenPos;
@ -1245,12 +1232,8 @@ namespace CodeImp.DoomBuilder.Rendering
bottomCount++; bottomCount++;
} }
if (behindCount == len || leftCount == len || rightCount == len || topCount == len || bottomCount == len) { bool notOnScreen = (behindCount == len || leftCount == len || rightCount == len || topCount == len || bottomCount == len);
//dbg return !notOnScreen;
//GZBuilder.GZGeneral.Trace("Skipped geo. Not on screen");
return false; //Not on screen
}
return true;
} }
//mxd //mxd

View file

@ -645,12 +645,22 @@ namespace CodeImp.DoomBuilder.VisualModes
#region ================== Object Picking #region ================== Object Picking
//mxd
public VisualPickResult PickObject(Vector3D from, Vector3D to) {
return PickObject(from, to, true);
}
// This picks an object from the scene // This picks an object from the scene
public VisualPickResult PickObject(Vector3D from, Vector3D to) public VisualPickResult PickObject(Vector3D from, Vector3D to, bool scaleHack)
{ {
//mxd GZDoom vertical scale hack //mxd GZDoom vertical scale hack
Vector3D from_orig = from;
Vector3D to_orig = to;
if(scaleHack) {
to.z *= SCALE_OFFSET; to.z *= SCALE_OFFSET;
from.z *= SCALE_OFFSET; from.z *= SCALE_OFFSET;
}
VisualPickResult result = new VisualPickResult(); VisualPickResult result = new VisualPickResult();
Line2D ray2d = new Line2D(from, to); Line2D ray2d = new Line2D(from, to);
@ -813,6 +823,10 @@ namespace CodeImp.DoomBuilder.VisualModes
// Setup final result // Setup final result
result.hitpos = from + to * result.u_ray; result.hitpos = from + to * result.u_ray;
//mxd. Hackish way to select Things correctly
if(scaleHack && result.picked is VisualThing)
return PickObject(from_orig, to_orig, false);
// Done // Done
return result; return result;
} }

View file

@ -340,9 +340,6 @@ namespace CodeImp.DoomBuilder.Windows
//update arg0str items //update arg0str items
if (General.Map.NamedScripts.Count > 0) { if (General.Map.NamedScripts.Count > 0) {
//dbg
GZBuilder.GZGeneral.Trace("Got " + General.Map.NamedScripts.Count + " script names");
ScriptItem[] sn = new ScriptItem[General.Map.NamedScripts.Count]; ScriptItem[] sn = new ScriptItem[General.Map.NamedScripts.Count];
General.Map.NamedScripts.CopyTo(sn, 0); General.Map.NamedScripts.CopyTo(sn, 0);
arg0str.Items.AddRange(sn); arg0str.Items.AddRange(sn);
@ -354,11 +351,7 @@ namespace CodeImp.DoomBuilder.Windows
} }
} }
//int index = General.Map.NamedScripts.IndexOf(selectedValue); } else {
//if (index != -1)
// arg0str.SelectedIndex = index;
}
else {
arg0str.Text = selectedValue; arg0str.Text = selectedValue;
} }
} }

View file

@ -190,7 +190,7 @@ namespace CodeImp.DoomBuilder.Windows
this.dockersspace = new System.Windows.Forms.Panel(); this.dockersspace = new System.Windows.Forms.Panel();
this.dockerspanel = new CodeImp.DoomBuilder.Controls.DockersControl(); this.dockerspanel = new CodeImp.DoomBuilder.Controls.DockersControl();
this.dockerscollapser = new System.Windows.Forms.Timer(this.components); this.dockerscollapser = new System.Windows.Forms.Timer(this.components);
this.warntimer = new System.Windows.Forms.Timer(this.components); this.warnsTimer = new System.Windows.Forms.Timer(this.components);
toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
@ -1745,10 +1745,10 @@ namespace CodeImp.DoomBuilder.Windows
this.dockerscollapser.Interval = 200; this.dockerscollapser.Interval = 200;
this.dockerscollapser.Tick += new System.EventHandler(this.dockerscollapser_Tick); this.dockerscollapser.Tick += new System.EventHandler(this.dockerscollapser_Tick);
// //
// warntimer // warnsTimer
// //
this.warntimer.Interval = 500; this.warnsTimer.Interval = 500;
this.warntimer.Tick += new System.EventHandler(this.warntimer_Tick); this.warnsTimer.Tick += new System.EventHandler(this.warnsTimer_Tick);
// //
// MainForm // MainForm
// //
@ -1944,10 +1944,10 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ToolStripButton buttontogglefx; private System.Windows.Forms.ToolStripButton buttontogglefx;
private System.Windows.Forms.ToolStripButton buttontogglefog; private System.Windows.Forms.ToolStripButton buttontogglefog;
private System.Windows.Forms.ToolStripStatusLabel warnsLabel; private System.Windows.Forms.ToolStripStatusLabel warnsLabel;
private System.Windows.Forms.Timer warntimer;
private System.Windows.Forms.ToolStripMenuItem itemReloadModedef; private System.Windows.Forms.ToolStripMenuItem itemReloadModedef;
private System.Windows.Forms.ToolStripMenuItem itemReloadGldefs; private System.Windows.Forms.ToolStripMenuItem itemReloadGldefs;
private System.Windows.Forms.ToolStripMenuItem itemReloadMapinfo; private System.Windows.Forms.ToolStripMenuItem itemReloadMapinfo;
private System.Windows.Forms.ToolStripSeparator separatorDrawModes; private System.Windows.Forms.ToolStripSeparator separatorDrawModes;
private System.Windows.Forms.Timer warnsTimer;
} }
} }

View file

@ -158,7 +158,7 @@ namespace CodeImp.DoomBuilder.Windows
private int lockupdatecount; private int lockupdatecount;
//mxd //mxd
private bool warnStatus; //status of warnings panel icon private int warningsCount;
#endregion #endregion
@ -2687,21 +2687,16 @@ namespace CodeImp.DoomBuilder.Windows
//mxd. Warnings panel //mxd. Warnings panel
internal void SetWarningsCount(int count) { internal void SetWarningsCount(int count) {
if (count == 0) { warningsCount = count;
if (warnsLabel.Font.Bold) {
warnsLabel.Font = new Font(warnsLabel.Font, FontStyle.Regular); if (warningsCount > 0 && !warnsLabel.Font.Bold)
warnsLabel.Image = global::CodeImp.DoomBuilder.Properties.Resources.WarningOff;
warnsLabel.BackColor = SystemColors.Control;
}
warntimer.Stop();
warnStatus = false;
} else if (!warnsLabel.Font.Bold) {
warnsLabel.Font = new Font(warnsLabel.Font, FontStyle.Bold); warnsLabel.Font = new Font(warnsLabel.Font, FontStyle.Bold);
warnsLabel.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning;
warnStatus = true; warnsLabel.Text = warningsCount.ToString();
warntimer.Start(); if (!warnsTimer.Enabled) {
warnsTimer.Enabled = true;
Console.WriteLine("warntimer Enabled");
} }
warnsLabel.Text = count.ToString();
} }
//mxd //mxd
@ -2710,15 +2705,25 @@ namespace CodeImp.DoomBuilder.Windows
} }
//mxd //mxd
private void warntimer_Tick(object sender, EventArgs e) { private void warnsTimer_Tick(object sender, EventArgs e) {
if (warnStatus) { Console.WriteLine("warntimer_Tick");
if (warningsCount > 0) {
if (warnsLabel.BackColor == Color.Red) {
warnsLabel.Font = new Font(warnsLabel.Font, FontStyle.Regular);
warnsLabel.Image = global::CodeImp.DoomBuilder.Properties.Resources.WarningOff; warnsLabel.Image = global::CodeImp.DoomBuilder.Properties.Resources.WarningOff;
warnsLabel.BackColor = Color.Red;
} else {
warnsLabel.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning;
warnsLabel.BackColor = SystemColors.Control; warnsLabel.BackColor = SystemColors.Control;
} else {
warnsLabel.Font = new Font(warnsLabel.Font, FontStyle.Bold);
warnsLabel.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning;
warnsLabel.BackColor = Color.Red;
}
} else {
warnsLabel.Font = new Font(warnsLabel.Font, FontStyle.Regular);
warnsLabel.Image = global::CodeImp.DoomBuilder.Properties.Resources.WarningOff;
warnsLabel.BackColor = SystemColors.Control;
warnsTimer.Stop();
} }
warnStatus = !warnStatus;
} }
#endregion #endregion

View file

@ -246,9 +246,6 @@
<metadata name="dockerscollapser.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="dockerscollapser.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>781, 17</value> <value>781, 17</value>
</metadata> </metadata>
<metadata name="warntimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>

View file

@ -216,9 +216,6 @@ namespace CodeImp.DoomBuilder.Windows
//update arg0str items //update arg0str items
if (General.Map.NamedScripts.Count > 0) { if (General.Map.NamedScripts.Count > 0) {
//dbg
GZBuilder.GZGeneral.Trace("Got " + General.Map.NamedScripts.Count + " script names");
ScriptItem[] sn = new ScriptItem[General.Map.NamedScripts.Count]; ScriptItem[] sn = new ScriptItem[General.Map.NamedScripts.Count];
General.Map.NamedScripts.CopyTo(sn, 0); General.Map.NamedScripts.CopyTo(sn, 0);
arg0str.Items.AddRange(sn); arg0str.Items.AddRange(sn);
@ -229,9 +226,7 @@ namespace CodeImp.DoomBuilder.Windows
break; break;
} }
} }
//int index = General.Map.NamedScripts.IndexOf(selectedValue);
//if (index != -1)
//arg0str.SelectedIndex = index;
} else { } else {
arg0str.Text = selectedValue; arg0str.Text = selectedValue;
} }

View file

@ -38,5 +38,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public const int SectorBrightnessChange = 3; public const int SectorBrightnessChange = 3;
public const int TextureOffsetChange = 4; public const int TextureOffsetChange = 4;
public const int SectorHeightChange = 5; public const int SectorHeightChange = 5;
public const int ThingMove = 6; //mxd
public const int ThingRotate = 7; //mxd
} }
} }

View file

@ -828,3 +828,26 @@ flipselectionh
allowscroll = true; allowscroll = true;
} }
//mxd
rotatethingscw
{
title = "Rotate Selected Things Clockwise";
category = "visual";
description = "Rotates selected things clockwise.";
allowkeys = true;
allowmouse = false;
allowscroll = true;
default = 262138;
}
//mxd
rotatethingsccw
{
title = "Rotate Selected Things Counterclockwise";
category = "visual";
description = "Rotates selected things counterclockwise.";
allowkeys = true;
allowmouse = false;
allowscroll = true;
default = 262139;
}

View file

@ -439,7 +439,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
return; return;
} }
PreAction(UndoGroup.SectorHeightChange); PreAction(UndoGroup.ThingMove);
Vector3D[] coords = new Vector3D[visualThings.Count]; Vector3D[] coords = new Vector3D[visualThings.Count];
for (int i = 0; i < visualThings.Count; i++) for (int i = 0; i < visualThings.Count; i++)
@ -1499,6 +1499,42 @@ namespace CodeImp.DoomBuilder.BuilderModes
PostAction(); PostAction();
} }
//mxd. rotate clockwise
[BeginAction("rotatethingscw")]
public void RotateThingsCW() {
List<VisualThing> things = GetSelectedVisualThings(true);
PreAction(UndoGroup.ThingRotate);
if (things.Count == 0) {
General.Interface.DisplayStatus(StatusType.Warning, "Select some Things first!");
return;
}
foreach (VisualThing t in things)
((BaseVisualThing)t).OnRotate(General.ClampAngle(t.Thing.AngleDoom + 5));
PostAction();
}
//mxd. rotate counterclockwise
[BeginAction("rotatethingsccw")]
public void RotateThingsCCW() {
List<VisualThing> things = GetSelectedVisualThings(true);
PreAction(UndoGroup.ThingRotate);
if (things.Count == 0) {
General.Interface.DisplayStatus(StatusType.Warning, "Select some Things first!");
return;
}
foreach (VisualThing t in things)
((BaseVisualThing)t).OnRotate(General.ClampAngle(t.Thing.AngleDoom - 5));
PostAction();
}
#endregion #endregion
} }
} }

View file

@ -474,7 +474,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
//mxd //mxd
public virtual void OnMove(Vector3D newPosition) { public void OnMove(Vector3D newPosition) {
if ((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket)) if ((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
undoticket = mode.CreateUndo("Move thing"); undoticket = mode.CreateUndo("Move thing");
Thing.Move(newPosition); Thing.Move(newPosition);
@ -482,6 +482,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.Changed = true; this.Changed = true;
} }
//mxd
public void OnRotate(int ammount) {
if ((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
undoticket = mode.CreateUndo("Rotate thing");
Thing.Rotate(ammount);
mode.SetActionResult("Changed thing rotation to " + Thing.AngleDoom.ToString() + ".");
this.Changed = true;
}
#endregion #endregion
} }
} }

View file

@ -38,5 +38,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
public const int SectorBrightnessChange = 3; public const int SectorBrightnessChange = 3;
public const int TextureOffsetChange = 4; public const int TextureOffsetChange = 4;
public const int SectorHeightChange = 5; public const int SectorHeightChange = 5;
public const int ThingMove = 6; //mxd
public const int ThingRotate = 7; //mxd
} }
} }

View file

@ -456,7 +456,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
return; return;
} }
PreAction(UndoGroup.SectorHeightChange); PreAction(UndoGroup.ThingMove);
Vector3D[] coords = new Vector3D[visualThings.Count]; Vector3D[] coords = new Vector3D[visualThings.Count];
for (int i = 0; i < visualThings.Count; i++) for (int i = 0; i < visualThings.Count; i++)
@ -1759,6 +1759,42 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
PostAction(); PostAction();
} }
//mxd. rotate clockwise
[BeginAction("rotatethingscw", Library = "BuilderModes")]
public void RotateThingsCW() {
List<VisualThing> things = GetSelectedVisualThings(true);
PreAction(UndoGroup.ThingRotate);
if (things.Count == 0) {
General.Interface.DisplayStatus(StatusType.Warning, "Select some Things first!");
return;
}
foreach (VisualThing t in things)
((BaseVisualThing)t).OnRotate(General.ClampAngle(t.Thing.AngleDoom + 5));
PostAction();
}
//mxd. rotate counterclockwise
[BeginAction("rotatethingsccw", Library = "BuilderModes")]
public void RotateThingsCCW() {
List<VisualThing> things = GetSelectedVisualThings(true);
PreAction(UndoGroup.ThingRotate);
if (things.Count == 0) {
General.Interface.DisplayStatus(StatusType.Warning, "Select some Things first!");
return;
}
foreach (VisualThing t in things)
((BaseVisualThing)t).OnRotate(General.ClampAngle(t.Thing.AngleDoom - 5));
PostAction();
}
#endregion #endregion
} }
} }

View file

@ -521,7 +521,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
} }
//mxd //mxd
public virtual void OnMove(Vector3D newPosition) { public void OnMove(Vector3D newPosition) {
if ((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket)) if ((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
undoticket = mode.CreateUndo("Move thing"); undoticket = mode.CreateUndo("Move thing");
Thing.Move(newPosition); Thing.Move(newPosition);
@ -539,6 +539,15 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
this.Changed = true; this.Changed = true;
} }
//mxd
public void OnRotate(int ammount) {
if ((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
undoticket = mode.CreateUndo("Rotate thing");
Thing.Rotate(ammount);
mode.SetActionResult("Changed thing rotation to " + Thing.AngleDoom.ToString() + ".");
this.Changed = true;
}
#endregion #endregion
} }
} }