- AddFlow API cleanup.

This commit is contained in:
Christoph Oelckers 2021-10-21 11:26:47 +02:00
parent 6bf6ac5b34
commit 73d415369d
3 changed files with 8 additions and 10 deletions

View file

@ -183,7 +183,7 @@ void AddFlash(short nSector, int x, int y, int z, int val);
void SetTorch(int nPlayer, int bTorchOnOff); void SetTorch(int nPlayer, int bTorchOnOff);
void UndoFlashes(); void UndoFlashes();
void DoLights(); void DoLights();
void AddFlow(int nSprite, int nSpeed, int b); void AddFlow(int nSprite, int nSpeed, int b, int ang = -1);
void BuildFlash(short nPlayer, short nSector, int nVal); void BuildFlash(short nPlayer, short nSector, int nVal);
void AddGlow(short nSector, int nVal); void AddGlow(short nSector, int nVal);
void AddFlicker(short nSector, int nVal); void AddFlicker(short nSector, int nVal);

View file

@ -708,7 +708,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag)
} }
case 88: case 88:
{ {
AddFlow(nSprite, nSpeed, 0); AddFlow(pSprite->sectnum, nSpeed, 0, pSprite->ang);
DeleteActor(pActor); DeleteActor(pActor);
return; return;
@ -723,7 +723,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag)
} }
case 78: case 78:
{ {
AddFlow(nSprite, nSpeed, 1); AddFlow(pSprite->sectnum, nSpeed, 1, pSprite->ang);
short nSector = pSprite->sectnum; short nSector = pSprite->sectnum;
SectFlag[nSector] |= 0x8000; SectFlag[nSector] |= 0x8000;

View file

@ -661,7 +661,7 @@ void DoFlickers()
} }
// nWall can also be passed in here via nSprite parameter - TODO - rename nSprite parameter :) // nWall can also be passed in here via nSprite parameter - TODO - rename nSprite parameter :)
void AddFlow(int nIndex, int nSpeed, int b) void AddFlow(int nIndex, int nSpeed, int b, int nAngle)
{ {
if (nFlowCount >= kMaxFlows) if (nFlowCount >= kMaxFlows)
return; return;
@ -672,18 +672,16 @@ void AddFlow(int nIndex, int nSpeed, int b)
if (b < 2) if (b < 2)
{ {
int sectnum = sprite[nIndex].sectnum; short nPic = sector[nIndex].floorpicnum;
short nPic = sector[sectnum].floorpicnum;
short nAngle = sprite[nIndex].ang;
sFlowInfo[nFlow].xacc = (tileWidth(nPic) << 14) - 1; sFlowInfo[nFlow].xacc = (tileWidth(nPic) << 14) - 1;
sFlowInfo[nFlow].yacc = (tileHeight(nPic) << 14) - 1; sFlowInfo[nFlow].yacc = (tileHeight(nPic) << 14) - 1;
sFlowInfo[nFlow].angcos = -bcos(nAngle) * nSpeed; sFlowInfo[nFlow].angcos = -bcos(nAngle) * nSpeed;
sFlowInfo[nFlow].angsin = bsin(nAngle) * nSpeed; sFlowInfo[nFlow].angsin = bsin(nAngle) * nSpeed;
sFlowInfo[nFlow].objindex = sectnum; sFlowInfo[nFlow].objindex = nIndex;
StartInterpolation(sectnum, b ? Interp_Sect_CeilingPanX : Interp_Sect_FloorPanX); StartInterpolation(nIndex, b ? Interp_Sect_CeilingPanX : Interp_Sect_FloorPanX);
StartInterpolation(sectnum, b ? Interp_Sect_CeilingPanY : Interp_Sect_FloorPanY); StartInterpolation(nIndex, b ? Interp_Sect_CeilingPanY : Interp_Sect_FloorPanY);
} }
else else
{ {