- fixed Exhumed panning setup.

Converted it to floating point and removed the nonsensical & with the texture size that was clearing significant bits.
This commit is contained in:
Christoph Oelckers 2021-12-22 13:57:10 +01:00
parent 6423684bfb
commit a2fc415b30
2 changed files with 15 additions and 73 deletions

View file

@ -14,6 +14,7 @@ enum EInterpolationType
Interp_Wall_Y, Interp_Wall_Y,
Interp_Pan_First, Interp_Pan_First,
// order of the following 4 flags must match the corresponding sector flags.
Interp_Sect_FloorPanX = Interp_Pan_First, Interp_Sect_FloorPanX = Interp_Pan_First,
Interp_Sect_FloorPanY, Interp_Sect_FloorPanY,
Interp_Sect_CeilingPanX, Interp_Sect_CeilingPanX,

View file

@ -73,12 +73,8 @@ struct Flow
sectortype* pSector; sectortype* pSector;
}; };
int type; int type;
int xdelta; float angcos;
int ydelta; float angsin;
int angcos;
int angsin;
int xacc;
int yacc;
}; };
@ -156,12 +152,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Flow& w, Flow* def
if (arc.BeginObject(keyname)) if (arc.BeginObject(keyname))
{ {
arc("type", w.type) arc("type", w.type)
("xdelta", w.xdelta)
("ydelta", w.ydelta)
("angcos", w.angcos) ("angcos", w.angcos)
("angsin", w.angsin) ("angsin", w.angsin);
("xacc", w.xacc)
("yacc", w.yacc);
if (w.type < 2) arc("index", w.pSector); if (w.type < 2) arc("index", w.pSector);
else arc("index", w.pWall); else arc("index", w.pWall);
arc.EndObject(); arc.EndObject();
@ -664,17 +656,13 @@ void AddFlow(sectortype* pSector, int nSpeed, int b, int nAngle)
int nPic = pSector->floorpicnum; int nPic = pSector->floorpicnum;
sFlowInfo[nFlow].xacc = (tileWidth(nPic) << 14) - 1; sFlowInfo[nFlow].angcos = float(-cos(nAngle * BAngRadian) * nSpeed);
sFlowInfo[nFlow].yacc = (tileHeight(nPic) << 14) - 1; sFlowInfo[nFlow].angsin = float(sin(nAngle * BAngRadian) * nSpeed);
sFlowInfo[nFlow].angcos = -bcos(nAngle) * nSpeed;
sFlowInfo[nFlow].angsin = bsin(nAngle) * nSpeed;
sFlowInfo[nFlow].pSector = pSector; sFlowInfo[nFlow].pSector = pSector;
StartInterpolation(pSector, b ? Interp_Sect_CeilingPanX : Interp_Sect_FloorPanX); StartInterpolation(pSector, b ? Interp_Sect_CeilingPanX : Interp_Sect_FloorPanX);
StartInterpolation(pSector, b ? Interp_Sect_CeilingPanY : Interp_Sect_FloorPanY); StartInterpolation(pSector, b ? Interp_Sect_CeilingPanY : Interp_Sect_FloorPanY);
sFlowInfo[nFlow].ydelta = 0;
sFlowInfo[nFlow].xdelta = 0;
sFlowInfo[nFlow].type = b; sFlowInfo[nFlow].type = b;
} }
@ -688,26 +676,15 @@ void AddFlow(walltype* pWall, int nSpeed, int b, int nAngle)
nFlowCount++; nFlowCount++;
StartInterpolation(pWall, Interp_Wall_PanX); // only moves up or down
StartInterpolation(pWall, Interp_Wall_PanY); StartInterpolation(pWall, Interp_Wall_PanY);
if (b == 2) {
nAngle = 512;
}
else {
nAngle = 1536;
}
int nPic = pWall->picnum; int nPic = pWall->picnum;
sFlowInfo[nFlow].xacc = (tileWidth(nPic) * pWall->xrepeat) << 8; sFlowInfo[nFlow].angcos = 0;
sFlowInfo[nFlow].yacc = (tileHeight(nPic) * pWall->yrepeat) << 8; sFlowInfo[nFlow].angsin = b == 2 ? 1 : -1;
sFlowInfo[nFlow].angcos = -bcos(nAngle) * nSpeed;
sFlowInfo[nFlow].angsin = bsin(nAngle) * nSpeed;
sFlowInfo[nFlow].pWall = pWall; sFlowInfo[nFlow].pWall = pWall;
sFlowInfo[nFlow].ydelta = 0;
sFlowInfo[nFlow].xdelta = 0;
sFlowInfo[nFlow].type = b; sFlowInfo[nFlow].type = b;
} }
@ -715,71 +692,35 @@ void DoFlows()
{ {
for (int i = 0; i < nFlowCount; i++) for (int i = 0; i < nFlowCount; i++)
{ {
sFlowInfo[i].xdelta += sFlowInfo[i].angcos;
sFlowInfo[i].ydelta += sFlowInfo[i].angsin;
switch (sFlowInfo[i].type) switch (sFlowInfo[i].type)
{ {
case 0: case 0:
{ {
sFlowInfo[i].xdelta &= sFlowInfo[i].xacc;
sFlowInfo[i].ydelta &= sFlowInfo[i].yacc;
auto pSector =sFlowInfo[i].pSector; auto pSector =sFlowInfo[i].pSector;
pSector->setfloorxpan(sFlowInfo[i].xdelta / 16384.f); pSector->addfloorxpan(sFlowInfo[i].angcos);
pSector->setfloorypan(sFlowInfo[i].ydelta / 16384.f); pSector->addfloorypan(sFlowInfo[i].angsin);
break; break;
} }
case 1: case 1:
{ {
auto pSector = sFlowInfo[i].pSector; auto pSector = sFlowInfo[i].pSector;
pSector->addceilingxpan(sFlowInfo[i].angcos);
pSector->setceilingxpan(sFlowInfo[i].xdelta / 16384.f); pSector->addceilingypan(sFlowInfo[i].angsin);
pSector->setceilingypan(sFlowInfo[i].ydelta / 16384.f);
sFlowInfo[i].xdelta &= sFlowInfo[i].xacc;
sFlowInfo[i].ydelta &= sFlowInfo[i].yacc;
break; break;
} }
case 2: case 2:
{ {
auto pWall = sFlowInfo[i].pWall; auto pWall = sFlowInfo[i].pWall;
pWall->addypan(sFlowInfo[i].angsin);
pWall->setxpan(sFlowInfo[i].xdelta / 16384.f);
pWall->setypan(sFlowInfo[i].ydelta / 16384.f);
if (sFlowInfo[i].xdelta < 0)
{
sFlowInfo[i].xdelta += sFlowInfo[i].xacc;
}
if (sFlowInfo[i].ydelta < 0)
{
sFlowInfo[i].ydelta += sFlowInfo[i].yacc;
}
break; break;
} }
case 3: case 3:
{ {
auto pWall = sFlowInfo[i].pWall; auto pWall = sFlowInfo[i].pWall;
pWall->addypan(sFlowInfo[i].angsin);
pWall->setxpan(sFlowInfo[i].xdelta / 16384.f);
pWall->setypan(sFlowInfo[i].ydelta / 16384.f);
if (sFlowInfo[i].xdelta >= sFlowInfo[i].xacc)
{
sFlowInfo[i].xdelta -= sFlowInfo[i].xacc;
}
if (sFlowInfo[i].ydelta >= sFlowInfo[i].yacc)
{
sFlowInfo[i].ydelta -= sFlowInfo[i].yacc;
}
break; break;
} }
} }