From c59163373343e13c1fc14bc69aba39de468c1aee Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Fri, 14 Jun 2019 14:13:41 -0300 Subject: [PATCH 1/5] Update m_misc.c --- src/m_misc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index 232ccb477..0445136fe 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1032,7 +1032,7 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal) static inline moviemode_t M_StartMovieAPNG(const char *pathname) { #ifdef USE_APNG - UINT8 *palette; + UINT8 *palette = NULL; const char *freename = NULL; boolean ret = false; @@ -1048,8 +1048,13 @@ static inline moviemode_t M_StartMovieAPNG(const char *pathname) return MM_OFF; } - if (rendermode == render_soft) M_CreateScreenShotPalette(); - ret = M_SetupaPNG(va(pandf,pathname,freename), (palette = screenshot_palette)); + if (rendermode == render_soft) + { + M_CreateScreenShotPalette(); + palette = screenshot_palette; + } + + ret = M_SetupaPNG(va(pandf,pathname,freename), palette); if (!ret) { From 50e8f13c0361e5fbab0b98492bd3f97c90150f69 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 17 Jun 2019 18:46:51 +0100 Subject: [PATCH 2/5] Fix FOF slopes briefly glitching on level load in software mode, by ensuring the FOFs' target sectors have hasslope set on creation --- src/p_spec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_spec.c b/src/p_spec.c index f3be86ee1..d4ead74fe 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4973,6 +4973,10 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f // Add slopes ffloor->t_slope = &sec2->c_slope; ffloor->b_slope = &sec2->f_slope; + // mark the target sector as having slopes, if the FOF has any of its own + // (this fixes FOF slopes glitching initially at level load in software mode) + if (sec2->hasslope) + sec->hasslope = true; #endif if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only From 1638fad75eafafb68aac4c0277bdf97acea34f0f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 17 Jun 2019 19:00:04 +0100 Subject: [PATCH 3/5] Part 2 of fix, make sure copied slopes also pass on hasslope status to attached target sectors for FOFs Also fix whitespace to use tab-style spaces instead of regular spaces, ew --- src/p_slopes.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 4e12b104f..8e646e730 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -584,23 +584,28 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag // void P_CopySectorSlope(line_t *line) { - sector_t *fsec = line->frontsector; - int i, special = line->special; + sector_t *fsec = line->frontsector; + int i, special = line->special; - // Check for copy linedefs - for(i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;) - { - sector_t *srcsec = sectors + i; + // Check for copy linedefs + for (i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;) + { + sector_t *srcsec = sectors + i; - if((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope) - fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope); - if((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope) - fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope); - } + if ((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope) + fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope); + if ((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope) + fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope); + } - fsec->hasslope = true; + fsec->hasslope = true; - line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef + // if this is an FOF control sector, make sure any target sectors also are marked as having slopes + if (fsec->numattached) + for (i = 0; i < fsec->numattached; i++) + sectors[fsec->attached[i]].hasslope = true; + + line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef } // From 62ed90b252eb42477159c6c652a4f51f9049c063 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 17 Jun 2019 20:54:06 +0100 Subject: [PATCH 4/5] fix type mismatch by typecasting --- src/p_slopes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 8e646e730..19d0bbbb7 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -602,7 +602,7 @@ void P_CopySectorSlope(line_t *line) // if this is an FOF control sector, make sure any target sectors also are marked as having slopes if (fsec->numattached) - for (i = 0; i < fsec->numattached; i++) + for (i = 0; i < (int)fsec->numattached; i++) sectors[fsec->attached[i]].hasslope = true; line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef From bc2804d383b95ccfcf400a04683fddd9105e6980 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 20 Jun 2019 13:24:54 +0100 Subject: [PATCH 5/5] Fix the clearly accidental duplication of lumpinfo's memory allocation in ResGetLumpsStandalone --- src/w_wad.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/w_wad.c b/src/w_wad.c index 5bf7a36d3..8641cf116 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -334,7 +334,6 @@ static restype_t ResourceFileDetect (const char* filename) static lumpinfo_t* ResGetLumpsStandalone (FILE* handle, UINT16* numlumps, const char* lumpname) { lumpinfo_t* lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL); - lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL); lumpinfo->position = 0; fseek(handle, 0, SEEK_END); lumpinfo->size = ftell(handle);