FIMGZTexture::~FIMGZTexture () { Unload (); if (Spans != NULL) { FreeSpans (Spans); Spans = NULL; } }
FCELTexture::~FCELTexture() { Unload(); if (NULL != m_spans) { FreeSpans(m_spans); } }
FFontChar2::~FFontChar2 () { Unload (); if (Spans != NULL) { FreeSpans (Spans); Spans = NULL; } }
FWarpTexture::~FWarpTexture () { Unload (); if (Spans != NULL) { FreeSpans (Spans); Spans = NULL; } delete SourcePic; }
// Fix for certain special patches on single-patch textures. void FPatchTexture::HackHack (int newheight) { BYTE *out; int x; Unload (); if (Spans != NULL) { FreeSpans (Spans); } { FMemLump lump = Wads.ReadLump (SourceLump); const patch_t *patch = (const patch_t *)lump.GetMem(); Width = LittleShort(patch->width); Height = newheight; LeftOffset = 0; TopOffset = 0; Pixels = new BYTE[Width * Height]; // Draw the image to the buffer for (x = 0, out = Pixels; x < Width; ++x) { const BYTE *in = (const BYTE *)patch + LittleLong(patch->columnofs[x]) + 3; for (int y = newheight; y > 0; --y) { *out = *in != 255 ? *in : Near255; out++, in++; } out += newheight; } } // Create the spans Spans = (Span **)M_Malloc (sizeof(Span *)*Width + sizeof(Span)*Width*2); Span *span = (Span *)&Spans[Width]; for (x = 0; x < Width; ++x) { Spans[x] = span; span[0].Length = newheight; span[0].TopOffset = 0; span[1].Length = 0; span[1].TopOffset = 0; span += 2; } }
FPNGTexture::~FPNGTexture () { Unload (); if (Spans != NULL) { FreeSpans (Spans); Spans = NULL; } if (PaletteMap != NULL && PaletteMap != GrayMap) { delete[] PaletteMap; PaletteMap = NULL; } }
void FWarpTexture::Unload () { if (Pixels != NULL) { delete[] Pixels; Pixels = NULL; } if (Spans != NULL) { FreeSpans (Spans); Spans = NULL; } SourcePic->Unload (); }
void FWarp2Texture::MakeTexture (DWORD time) { const BYTE *otherpix = SourcePic->GetPixels (); if (Pixels == NULL) { Pixels = new BYTE[Width * Height]; } if (Spans != NULL) { FreeSpans (Spans); Spans = NULL; } GenTime = time; WarpBufferType2(Pixels, otherpix, Width, Height, WidthOffsetMultiplier, HeightOffsetMultiplier, time, Speed); }
FMultiPatchTexture::~FMultiPatchTexture () { Unload (); if (Parts != NULL) { for(int i=0; i<NumParts;i++) { if (Parts[i].Translation != NULL) delete Parts[i].Translation; } delete[] Parts; Parts = NULL; } if (Spans != NULL) { FreeSpans (Spans); Spans = NULL; } }
void FPatchTexture::HackHack (int newheight) { // Check if this patch is likely to be a problem. // It must be 256 pixels tall, and all its columns must have exactly // one post, where each post has a supposed length of 0. FMemLump lump = Wads.ReadLump (SourceLump); const patch_t *realpatch = (patch_t *)lump.GetMem(); const DWORD *cofs = realpatch->columnofs; int x, x2 = LittleShort(realpatch->width); if (LittleShort(realpatch->height) == 256) { for (x = 0; x < x2; ++x) { const column_t *col = (column_t*)((BYTE*)realpatch+LittleLong(cofs[x])); if (col->topdelta != 0 || col->length != 0) { break; // It's not bad! } col = (column_t *)((BYTE *)col + 256 + 4); if (col->topdelta != 0xFF) { break; // More than one post in a column! } } if (x == x2) { // If all the columns were checked, it needs fixing. Unload (); if (Spans != NULL) { FreeSpans (Spans); } Height = newheight; LeftOffset = 0; TopOffset = 0; hackflag = true; bMasked = false; // Hacked textures don't have transparent parts. } } }