From 095391ed3a2abe23bf9e40c499e3a78684255c78 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 3 Jun 2021 17:21:10 +0200 Subject: [PATCH] - WH: interpolation --- source/games/whaven/src/animate.cpp | 35 +++++++++++++++++++++++++++-- source/games/whaven/src/whmap.cpp | 2 +- source/games/whaven/src/whtag.cpp | 7 ++++-- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/source/games/whaven/src/animate.cpp b/source/games/whaven/src/animate.cpp index 506392a72..a883c50e4 100644 --- a/source/games/whaven/src/animate.cpp +++ b/source/games/whaven/src/animate.cpp @@ -1,5 +1,6 @@ #include "ns.h" #include "wh.h" +#include "interpolate.h" BEGIN_WH_NS @@ -42,7 +43,22 @@ int setanimation(int index, int thegoal, int thevel, int theacc, int type) gAnm.vel = thevel; gAnm.acc = theacc; gAnm.type = (byte)type; - // todo: setinterpolation + + switch (gAnm.type) + { + case WALLX: + StartInterpolation(gAnm.id, Interp_Wall_X); + break; + case WALLY: + StartInterpolation(gAnm.id, Interp_Wall_Y); + break; + case FLOORZ: + StartInterpolation(gAnm.id, Interp_Sect_Floorz); + break; + case CEILZ: + StartInterpolation(gAnm.id, Interp_Sect_Ceilingz); + break; + } if (j == gAnimationCount) gAnimationCount++; @@ -90,7 +106,22 @@ void doanimations() if (j == gAnm.goal) { - // todo: stopinterpolation + switch (gAnm.type) + { + case WALLX: + StopInterpolation(gAnm.id, Interp_Wall_X); + break; + case WALLY: + StopInterpolation(gAnm.id, Interp_Wall_Y); + break; + case FLOORZ: + StopInterpolation(gAnm.id, Interp_Sect_Floorz); + break; + case CEILZ: + StopInterpolation(gAnm.id, Interp_Sect_Ceilingz); + break; + } + gAnimationCount--; if (i != gAnimationCount) gAnm = gAnimationData[gAnimationCount]; diff --git a/source/games/whaven/src/whmap.cpp b/source/games/whaven/src/whmap.cpp index e13accf44..3aec45a6a 100644 --- a/source/games/whaven/src/whmap.cpp +++ b/source/games/whaven/src/whmap.cpp @@ -236,7 +236,7 @@ boolean prepareboard(const char* fname) { killcnt = 0; kills = 0; expgained = 0; - // numinterpolations=0; + ClearInterpolations(); // the new mirror code floormirrorcnt = 0; diff --git a/source/games/whaven/src/whtag.cpp b/source/games/whaven/src/whtag.cpp index 7f1437b26..430de99fb 100644 --- a/source/games/whaven/src/whtag.cpp +++ b/source/games/whaven/src/whtag.cpp @@ -936,8 +936,7 @@ void animatetags(int nPlayer) { dragpoint((short) j, wall[j].x + dragxdir[i], wall[j].y + dragydir[i]); j = sector[dasector].floorz; -#pragma message ("setinterpolation") - //game.pInt.setceilinterpolate(dasector, sector[dasector]); + StartInterpolation(dasector, Interp_Sect_Floorz); sector[dasector].floorz = dragfloorz[i] + bsin(PlayClock << 4, -3); if (plr.sector == dasector) { @@ -971,6 +970,8 @@ void animatetags(int nPlayer) { Point out = rotatepoint(swingdoor[i].x[0], swingdoor[i].y[0], swingdoor[i].x[k], swingdoor[i].y[k], (short) swingdoor[i].ang); + StartInterpolation(swingdoor[i].wall[k], Interp_Wall_X); + StartInterpolation(swingdoor[i].wall[k], Interp_Wall_Y); dragpoint((short)swingdoor[i].wall[k], out.getX(), out.getY()); } if (swingdoor[i].anginc != 0) { @@ -988,6 +989,8 @@ void animatetags(int nPlayer) { Point out = rotatepoint(swingdoor[i].x[0], swingdoor[i].y[0], swingdoor[i].x[k], swingdoor[i].y[k], (short) swingdoor[i].ang); + StartInterpolation(swingdoor[i].wall[k], Interp_Wall_X); + StartInterpolation(swingdoor[i].wall[k], Interp_Wall_Y); dragpoint((short)swingdoor[i].wall[k], out.getX(), out.getY()); } swingdoor[i].anginc = -swingdoor[i].anginc;