From 916cd0155079ce9122fdeee8ce1fae13d4c02cec Mon Sep 17 00:00:00 2001 From: NY00123 Date: Thu, 21 May 2020 21:42:48 +0300 Subject: [PATCH] SW: While not exactly a favorite of mine, this fixes the floorz updates of the secret rotating pillar in level 1 with SO interpolation. The drill in level 2 is also covered. So far, SetVatorActive seems to be the only place where interpolation of ceiling/floorz may be set, outside of the SO interpolation code. --- source/sw/src/game.cpp | 2 +- source/sw/src/interpso.cpp | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index f68d8b1a0..c42544d10 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -142,7 +142,7 @@ SWBOOL Global_PLock = FALSE; #endif // 12 was original source release. For future releases increment by two. -int GameVersion = 15; +int GameVersion = 17; char DemoText[3][64]; int DemoTextYstart = 0; diff --git a/source/sw/src/interpso.cpp b/source/sw/src/interpso.cpp index ee5d23bd5..682f9099d 100644 --- a/source/sw/src/interpso.cpp +++ b/source/sw/src/interpso.cpp @@ -32,6 +32,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "game.h" #include "interp.h" #include "interpso.h" +#include "names2.h" BEGIN_SW_NS @@ -52,6 +53,7 @@ static struct so_interp int32_t numinterpolations; int32_t tic, lasttic; + SWBOOL hasvator; } so_interpdata[MAX_SECTOR_OBJECTS]; static void so_setpointinterpolation(so_interp *interp, int32_t *posptr) @@ -116,6 +118,7 @@ void so_addinterpolation(SECTOR_OBJECTp sop) so_interp *interp = &so_interpdata[sop - SectorObject]; interp->numinterpolations = 0; + interp->hasvator = FALSE; for (sectp = sop->sectp; *sectp; sectp++) { @@ -136,10 +139,19 @@ void so_addinterpolation(SECTOR_OBJECTp sop) } } - so_setpointinterpolation(interp, &(*sectp)->ceilingz); - so_setpointinterpolation(interp, &(*sectp)->floorz); + for (SPRITES_OF_SECT(*sectp - sector, i)) + if (sprite[i].statnum == STAT_VATOR && SP_TAG1(sprite+i) == SECT_VATOR) + break; + interp->hasvator |= (i >= 0); } + if (!interp->hasvator) + for (sectp = sop->sectp; *sectp; sectp++) + { + so_setpointinterpolation(interp, &(*sectp)->ceilingz); + so_setpointinterpolation(interp, &(*sectp)->floorz); + } + // interpolate midpoint, for aiming at a remote controlled SO so_setpointinterpolation(interp, &sop->xmid); so_setpointinterpolation(interp, &sop->ymid); @@ -155,7 +167,8 @@ void so_setspriteinterpolation(SECTOR_OBJECTp sop, spritetype *sp) so_setpointinterpolation(interp, &sp->x); so_setpointinterpolation(interp, &sp->y); - so_setpointinterpolation(interp, &sp->z); + if (!interp->hasvator) + so_setpointinterpolation(interp, &sp->z); so_setspriteanginterpolation(interp, &sp->ang, sp - sprite); } @@ -165,7 +178,8 @@ void so_stopspriteinterpolation(SECTOR_OBJECTp sop, spritetype *sp) so_stopdatainterpolation(interp, &sp->x); so_stopdatainterpolation(interp, &sp->y); - so_stopdatainterpolation(interp, &sp->z); + if (!interp->hasvator) + so_stopdatainterpolation(interp, &sp->z); so_stopdatainterpolation(interp, &sp->ang); } @@ -316,6 +330,7 @@ SWBOOL so_writeinterpolations(MFILE_WRITE fil) { so_interp::interp_data *data = interp->data; MWRITE(&interp->numinterpolations,sizeof(interp->numinterpolations),1,fil); + MWRITE(&interp->hasvator,sizeof(interp->hasvator),1,fil); for (i = 0; i < interp->numinterpolations; i++, data++) { saveisshot |= SaveSymDataInfo(fil, data->curipos); @@ -340,6 +355,7 @@ SWBOOL so_readinterpolations(MFILE_READ fil) { so_interp::interp_data *data = interp->data; MREAD(&interp->numinterpolations,sizeof(interp->numinterpolations),1,fil); + MREAD(&interp->hasvator,sizeof(interp->hasvator),1,fil); for (i = 0; i < interp->numinterpolations; i++, data++) { saveisshot |= LoadSymDataInfo(fil, (void **)&data->curipos);