- WH: interpolation

This commit is contained in:
Christoph Oelckers 2021-06-03 17:21:10 +02:00
parent fc5e0ae229
commit 095391ed3a
3 changed files with 39 additions and 5 deletions

View file

@ -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];

View file

@ -236,7 +236,7 @@ boolean prepareboard(const char* fname) {
killcnt = 0;
kills = 0;
expgained = 0;
// numinterpolations=0;
ClearInterpolations();
// the new mirror code
floormirrorcnt = 0;

View file

@ -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;