From 8034b0558eda082ae294d8ec4cb746b97179ea25 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 24 May 2009 07:58:57 +0000 Subject: [PATCH] - Fixed: Textures with dimensions <= 0 are invalid and should be treated as NULL textures. They also must be set to dimensions other than (0,0) to avoid division by zero errors. - Fixed: Random spawners did not handle the MF_DROPPED flag. SVN r1602 (trunk) --- docs/rh-log.txt | 4 ++++ src/g_shared/a_randomspawner.cpp | 1 + src/textures/multipatchtexture.cpp | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 0b6ac745d..8e8e1e718 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -8,6 +8,10 @@ mouse input would be frozen until the mouse was ungrabbed again. May 23, 2009 (Changes by Graf Zahl) +- Fixed: Textures with dimensions <= 0 are invalid and should be treated as NULL + textures. They also must be set to dimensions other than (0,0) to avoid division + by zero errors. +- Fixed: Random spawners did not handle the MF_DROPPED flag. - Fixed: When setting up a deep water sector with Transfer_Heights the floorclip information of all actors in the sector needs to be updated. diff --git a/src/g_shared/a_randomspawner.cpp b/src/g_shared/a_randomspawner.cpp index e54f31756..579ccb30d 100644 --- a/src/g_shared/a_randomspawner.cpp +++ b/src/g_shared/a_randomspawner.cpp @@ -80,6 +80,7 @@ class ARandomSpawner : public AActor newmobj->target = target; newmobj->tracer = tracer; newmobj->CopyFriendliness(this, false); + if (!(flags & MF_DROPPED)) newmobj->flags &= ~MF_DROPPED; // Special1 is used to count how many recursions we're in. if (newmobj->IsKindOf(PClass::FindClass("RandomSpawner"))) newmobj->special1 = ++special1; diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 3af98f224..995046936 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -1146,7 +1146,7 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype) sc.MustGetNumber(); Height = sc.Number; UseType = usetype; - + if (sc.CheckString("{")) { while (!sc.CheckString("}")) @@ -1200,7 +1200,7 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype) Parts = new TexPart[NumParts]; memcpy(Parts, &parts[0], NumParts * sizeof(*Parts)); - CalcBitSize (); + //CalcBitSize (); // If this texture is just a wrapper around a single patch, we can simply // forward GetPixels() and GetColumn() calls to that patch. @@ -1216,6 +1216,16 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype) } } } + + if (Width <= 0 || Height <= 0) + { + UseType = FTexture::TEX_Null; + Printf("Texture %s has invalid dimensions (%d, %d)\n", Name, Width, Height); + Width = Height = 1; + } + CalcBitSize (); + + sc.SetCMode(false); }