From a53bfa71136b656e240c675a9c72c1e2cb6886f4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 13 Apr 2008 11:40:53 +0000 Subject: [PATCH] - Fixed a few bufs in the parser for composite textures. - Changed: When loading Zips all patches in the patches/ directory should be loaded, not only those used by a texture in TEXTUREx. - Disabled timidity_mastervolume for the internal Timidity again because with the altered volume calculation it is no longer needed and the default volume is on the same level as OPL and FMOD. SVN r909 (trunk) --- docs/rh-log.txt | 8 ++++++ src/r_data.h | 1 + src/r_defs.h | 3 ++ src/sound/music_timidity_mididevice.cpp | 4 ++- src/textures/multipatchtexture.cpp | 38 ++++++++++++++++++------- src/textures/texturemanager.cpp | 24 +++++++++++++--- 6 files changed, 63 insertions(+), 15 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 714c6e757..62b7c9f4e 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,11 @@ +April 13, 2008 (Changes by Graf Zahl) +- Fixed a few bufs in the parser for composite textures. +- Changed: When loading Zips all patches in the patches/ directory should + be loaded, not only those used by a texture in TEXTUREx. +- Disabled timidity_mastervolume for the internal Timidity again because + with the altered volume calculation it is no longer needed and the default + volume is on the same level as OPL and FMOD. + April 12, 2008 - Changed FMOD_INIT_ENABLE_DSPNET use to its replacement from 4.14.00, FMOD_INIT_ENABLE_PROFILE. Renamed the corresponding cvar to snd_profile. diff --git a/src/r_data.h b/src/r_data.h index acc19911b..e91c41e4d 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -89,6 +89,7 @@ public: const BYTE *GetColumn (unsigned int column, const Span **spans_out); const BYTE *GetPixels (); FTextureFormat GetFormat(); + bool UseBasePalette() ; void Unload (); virtual void SetFrontSkyLayer (); diff --git a/src/r_defs.h b/src/r_defs.h index bc5bfc204..f8c744e11 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -759,6 +759,9 @@ public: BYTE bHasCanvas:1; // Texture is based off FCanvasTexture BYTE bWarped:2; // This is a warped texture. Used to avoid multiple warps on one texture BYTE bIsPatch:1; // 1 if an FPatchTexture. Required to fix FMultipatchTexture::CheckForHacks + BYTE bComplex:1; // Will be used to mark extended MultipatchTextures that have to be + // fully composited before subjected to any kinf of postprocessing instead of + // doing it per patch. WORD Rotations; diff --git a/src/sound/music_timidity_mididevice.cpp b/src/sound/music_timidity_mididevice.cpp index 382b4a8f2..abaf3b44a 100644 --- a/src/sound/music_timidity_mididevice.cpp +++ b/src/sound/music_timidity_mididevice.cpp @@ -205,7 +205,7 @@ int TimidityMIDIDevice::Resume() { if (!Started) { - if (Stream->Play(true, timidity_mastervolume)) + if (Stream->Play(true, 1/*timidity_mastervolume*/)) { Started = true; return 0; @@ -335,10 +335,12 @@ bool TimidityMIDIDevice::NeedThreadedCallback() void TimidityMIDIDevice::TimidityVolumeChanged() { + /* if (Stream != NULL) { Stream->SetVolume(timidity_mastervolume); } + */ } //========================================================================== diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 4422eff7d..96caa452e 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -457,15 +457,28 @@ int FMultiPatchTexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf FTextureFormat FMultiPatchTexture::GetFormat() { if (NumParts == 1) return Parts[0].Texture->GetFormat(); - - for(int i=0;iUseBasePalette()) return TEX_RGB; - } - return TEX_Pal; + return UseBasePalette() ? TEX_Pal : TEX_RGB; } +//=========================================================================== +// +// FMultipatchTexture::UseBasePalette +// +// returns true if all patches in the texture use the unmodified base +// palette. +// +//=========================================================================== + +bool FMultiPatchTexture::UseBasePalette() +{ + for(int i=0;iUseBasePalette()) return false; + } + return true; +} + //========================================================================== // // FMultiPatchTexture :: TexPart :: TexPart @@ -723,17 +736,21 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part) FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype) +: Pixels (0), Spans(0), Parts(0), bRedirect(false) { TArray parts; + sc.SetCMode(true); sc.MustGetString(); uppercopy(Name, sc.String); + Name[8] = 0; sc.MustGetStringName(","); sc.MustGetNumber(); Width = sc.Number; sc.MustGetStringName(","); sc.MustGetNumber(); Height = sc.Number; + UseType = FTexture::TEX_Override; if (sc.CheckString("{")) { @@ -754,6 +771,10 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype) { bWorldPanning = true; } + else if (sc.Compare("NullTexture")) + { + UseType = FTexture::TEX_Null; + } else if (sc.Compare("NoDecals")) { bNoDecals = true; @@ -767,7 +788,6 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype) } NumParts = parts.Size(); - UseType = FTexture::TEX_Override; Parts = new TexPart[NumParts]; memcpy(Parts, &parts[0], NumParts * sizeof(*Parts)); @@ -787,9 +807,7 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype) } //DefinitionLump = sc.G deflumpnum; } - - - + sc.SetCMode(false); } diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index dce1ec094..0fe074397 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -386,8 +386,21 @@ int FTextureManager::AddPatch (const char *patchname, int namespc, bool tryany) void FTextureManager::AddGroup(int wadnum, const char * startlump, const char * endlump, int ns, int usetype) { - int firsttx = Wads.CheckNumForName (startlump); - int lasttx = Wads.CheckNumForName (endlump); + int firsttx; + int lasttx; + + if (startlump && endlump) + { + firsttx = Wads.CheckNumForName (startlump); + lasttx = Wads.CheckNumForName (endlump); + } + else + { + // If there are no markers we have to search the entire lump directory... :( + firsttx = 0; + lasttx = Wads.GetNumLumps() - 1; + } + char name[9]; if (firsttx == -1 || lasttx == -1) @@ -404,7 +417,7 @@ void FTextureManager::AddGroup(int wadnum, const char * startlump, const char * for (firsttx += 1; firsttx < lasttx; ++firsttx) { - if (Wads.GetLumpFile(firsttx) == wadnum) + if (Wads.GetLumpFile(firsttx) == wadnum && Wads.GetLumpNamespace(firsttx) == ns) { Wads.GetLumpName (name, firsttx); @@ -696,6 +709,10 @@ void FTextureManager::AddTexturesForWad(int wadnum) // First step: Load sprites AddGroup(wadnum, "S_START", "S_END", ns_sprites, FTexture::TEX_Sprite); + // When loading a Zip, all graphics in the patches/ directory should be + // added as well. + AddGroup(wadnum, NULL, NULL, ns_patches, FTexture::TEX_WallPatch); + // Second step: TEXTUREx lumps LoadTextureX(wadnum); @@ -721,7 +738,6 @@ void FTextureManager::AddTexturesForWad(int wadnum) if (ns == ns_global) { // In Zips all graphics must be in a separate namespace. - if (Wads.GetLumpFlags(i) & LUMPF_ZIPFILE) continue; // Ignore lumps with empty names. if (Wads.CheckLumpName(i, "")) continue;