From f6984314b7020bf8ce6eced5ad83cadd776bd527 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 30 Mar 2021 21:28:27 +0200 Subject: [PATCH] - SW: let sector objects properly invalidate the sector they are in. --- source/games/sw/src/interpso.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index cb5ef9e1c..48c211376 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -69,7 +69,7 @@ static struct so_interp bool hasvator; } so_interpdata[MAX_SECTOR_OBJECTS]; -static int &getvalue(int element) +static int &getvalue(int element, bool write) { static int scratch; int index = element & soi_base; @@ -77,8 +77,10 @@ static int &getvalue(int element) switch (type) { case soi_wallx: + if (write) sector[wall[index].sector].dirty = 255; return wall[index].x; case soi_wally: + if (write) sector[wall[index].sector].dirty = 255; return wall[index].y; case soi_ceil: return sector[index].ceilingz; @@ -116,7 +118,7 @@ static void so_setpointinterpolation(so_interp *interp, int element) data->curelement = element; data->oldipos = data->lastipos = - data->lastoldipos = getvalue(element); + data->lastoldipos = getvalue(element, false); data->spriteofang = -1; } @@ -268,7 +270,7 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings data->oldipos = sprite[data->spriteofang].ang; } else - data->oldipos = getvalue(data->curelement); + data->oldipos = getvalue(data->curelement, false); if (!interpolating) data->lastipos = data->lastoldipos = data->oldipos; @@ -297,7 +299,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b for (i = 0; i < interp->numinterpolations; i++) interp->data[i].bakipos = (interp->data[i].spriteofang >= 0) ? sprite[interp->data[i].spriteofang].ang : - getvalue(interp->data[i].curelement); + getvalue(interp->data[i].curelement, false); if (interp->tic == 0) // Only if the SO has just moved { @@ -361,7 +363,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b else { delta = data->lastipos - data->lastoldipos; - getvalue(data->curelement) = data->lastoldipos + MulScale(delta, ratio, 16); + getvalue(data->curelement, true) = data->lastoldipos + MulScale(delta, ratio, 16); } } } @@ -385,7 +387,7 @@ void so_restoreinterpolations(void) // Stick at end of drawscree if (data->spriteofang >= 0) sprite[data->spriteofang].ang = data->bakipos; else - getvalue(data->curelement) = data->bakipos; + getvalue(data->curelement, true) = data->bakipos; } }