From 93c5753270a00f68b1ebac8bd25c906d75bde927 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 19 May 2006 05:14:37 +0000 Subject: [PATCH] - Added a NULL sector check to P_CheckFakeFloorTrigger() because there was a crash report indicating that an actor being pushed up by a moving floor had a NULL sector. Since this field should be valid for every actor, the debug build gets an assert here, and the release build just returns without doing anything. - Fixed: Camera textures were not rendered properly when the underlying canvas's pitch and width were different (which, really, only happens if you use ridiculously large camera textures). - Fixed: FCanvasTextureInfo's were never freed. - Fixed: MAPINFO special action structures were not freed. - Fixed: FSingleLumpFont::LoadFON2() never freed its widths2 array. SVN r129 (trunk) --- docs/rh-log.txt | 15 ++++++++++++++- src/g_level.cpp | 6 ++++++ src/m_random.cpp | 1 + src/p_mobj.cpp | 5 +++++ src/r_data.cpp | 13 +++++++------ src/r_defs.h | 2 +- src/r_main.cpp | 3 ++- src/v_font.cpp | 1 + 8 files changed, 37 insertions(+), 9 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 8174813cf0..a7ccb3c46d 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,16 @@ +May 18, 2006 +- Added a NULL sector check to P_CheckFakeFloorTrigger() because there was + a crash report indicating that an actor being pushed up by a moving floor + had a NULL sector. Since this field should be valid for every actor, the + debug build gets an assert here, and the release build just returns without + doing anything. +- Fixed: Camera textures were not rendered properly when the underlying + canvas's pitch and width were different (which, really, only happens if + you use ridiculously large camera textures). +- Fixed: FCanvasTextureInfo's were never freed. +- Fixed: MAPINFO special action structures were not freed. +- Fixed: FSingleLumpFont::LoadFON2() never freed its widths2 array. + May 17, 2006 (Changes by Graf Zahl) - Fixed: In case the path to strife1.wad didn't contain any '/' an incorrect path was created for voices.wad. @@ -1552,7 +1565,7 @@ February 10, 2005 - Fixed: P_ExplodeMissile() should zero the projectile's speed before putting it into its DeathState, not after. Strife's flamethrower needs it like this, and I'm not sure when or why it was moved to happen after the state change. -- Fixed: R_DrawSkyBoxes() needs to save and restory viewx and viewy as well as viewz +- Fixed: R_DrawSkyBoxes() needs to save and restore viewx and viewy as well as viewz for drawing masked items. - Fixed: P_MorphPlayer() did not properly transfer ownership of inventory items, so when it destroyed the player's armor, it also unlinked anything after the armor in diff --git a/src/g_level.cpp b/src/g_level.cpp index 4d87f3495a..fe411483f8 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -666,6 +666,12 @@ static void ClearLevelInfoStrings(level_info_t *linfo) delete[] linfo->level_name; linfo->level_name = NULL; } + for (FSpecialAction *spac = linfo->specialactions; spac != NULL; ) + { + FSpecialAction *next = spac->Next; + delete spac; + spac = next; + } } static void ClearClusterInfoStrings(cluster_info_t *cinfo) diff --git a/src/m_random.cpp b/src/m_random.cpp index f96148b12a..40fa1b8328 100644 --- a/src/m_random.cpp +++ b/src/m_random.cpp @@ -170,6 +170,7 @@ int FRandom::HitDice (int count) void FRandom::StaticClearRandom () { + Printf ("init with seed %d\n", rngseed); const DWORD seed = rngseed*2+1; // add 3/26/98: add rngseed FRandom *rng = FRandom::RNGList; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index e74c9d236c..b5350b95d9 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2002,6 +2002,11 @@ void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz) return; } sector_t *sec = mo->Sector; + assert (sec != NULL); + if (sec == NULL) + { + return; + } if (sec->heightsec != NULL && sec->SecActTarget != NULL) { sector_t *hs = sec->heightsec; diff --git a/src/r_data.cpp b/src/r_data.cpp index 92b3bcdd80..15e7f4685f 100644 --- a/src/r_data.cpp +++ b/src/r_data.cpp @@ -1026,7 +1026,7 @@ void FTexture::FlipSquareBlockRemap (BYTE *block, int x, int y, const BYTE *rema } } -void FTexture::FlipNonSquareBlock (BYTE *dst, const BYTE *src, int x, int y) +void FTexture::FlipNonSquareBlock (BYTE *dst, const BYTE *src, int x, int y, int srcpitch) { int i, j; @@ -1034,7 +1034,7 @@ void FTexture::FlipNonSquareBlock (BYTE *dst, const BYTE *src, int x, int y) { for (j = 0; j < y; ++j) { - dst[i*y+j] = src[i+j*x]; + dst[i*y+j] = src[i+j*srcpitch]; } } } @@ -1982,7 +1982,7 @@ void FPNGTexture::MakeTexture () } else { - FlipNonSquareBlock (newpix, Pixels, Width, Height); + FlipNonSquareBlock (newpix, Pixels, Width, Height, Width); } BYTE *oldpix = Pixels; Pixels = newpix; @@ -2631,7 +2631,7 @@ void FCanvasTexture::MakeTexture () { Canvas = new DSimpleCanvas (Width, Height); Canvas->Lock (); - if (Width != Height) + if (Width != Height || Width != Canvas->GetPitch()) { Pixels = new BYTE[Width*Height]; } @@ -2678,13 +2678,13 @@ void FCanvasTexture::RenderView (AActor *viewpoint, int fov) R_SetFOV (fov); R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, Width, Height); R_SetFOV (savedfov); - if (Width == Height) + if (Pixels == Canvas->GetBuffer()) { FlipSquareBlock (Pixels, Width, Height); } else { - FlipNonSquareBlock (Pixels, Canvas->GetBuffer(), Width, Height); + FlipNonSquareBlock (Pixels, Canvas->GetBuffer(), Width, Height, Canvas->GetPitch()); } bNeedsUpdate = false; bDidUpdate = true; @@ -3037,6 +3037,7 @@ void R_DeinitData () { R_DeinitColormaps (); R_DeinitBuildTiles(); + FCanvasTextureInfo::EmptyList(); // Free openings if (openings != NULL) diff --git a/src/r_defs.h b/src/r_defs.h index effbc64a4c..8794cc62e2 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -664,7 +664,7 @@ protected: static void FlipSquareBlock (BYTE *block, int x, int y); static void FlipSquareBlockRemap (BYTE *block, int x, int y, const BYTE *remap); - static void FlipNonSquareBlock (BYTE *blockto, const BYTE *blockfrom, int x, int y); + static void FlipNonSquareBlock (BYTE *blockto, const BYTE *blockfrom, int x, int y, int srcpitch); static void FlipNonSquareBlockRemap (BYTE *blockto, const BYTE *blockfrom, int x, int y, const BYTE *remap); }; diff --git a/src/r_main.cpp b/src/r_main.cpp index d59fd6adc1..f21e2cd47a 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -206,6 +206,8 @@ void (*hcolfunc_post4) (int sx, int yl, int yh); cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles; +FCanvasTextureInfo *FCanvasTextureInfo::List; + // PRIVATE DATA DEFINITIONS ------------------------------------------------ static int lastcenteryfrac; @@ -1545,7 +1547,6 @@ void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, viewactive = savedviewactive; } -FCanvasTextureInfo *FCanvasTextureInfo::List; //========================================================================== // // FCanvasTextureInfo :: Add diff --git a/src/v_font.cpp b/src/v_font.cpp index e862e0925e..df16cff83f 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -778,6 +778,7 @@ void FSingleLumpFont::LoadFON2 (int lump, const BYTE *data) } BuildTranslations (luminosity, identity); + delete[] widths2; } void FSingleLumpFont::FixupPalette (BYTE *identity, double *luminosity, const BYTE *palette, bool rescale)