From 73d415369d650bbbccab0f714b01bf48c7553fa4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 21 Oct 2021 11:26:47 +0200 Subject: [PATCH] - AddFlow API cleanup. --- source/games/exhumed/src/aistuff.h | 2 +- source/games/exhumed/src/init.cpp | 4 ++-- source/games/exhumed/src/lighting.cpp | 12 +++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index 5dcd70b9e..c62795478 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -183,7 +183,7 @@ void AddFlash(short nSector, int x, int y, int z, int val); void SetTorch(int nPlayer, int bTorchOnOff); void UndoFlashes(); 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 AddGlow(short nSector, int nVal); void AddFlicker(short nSector, int nVal); diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 4b90e338d..d9e70b3ba 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -708,7 +708,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 88: { - AddFlow(nSprite, nSpeed, 0); + AddFlow(pSprite->sectnum, nSpeed, 0, pSprite->ang); DeleteActor(pActor); return; @@ -723,7 +723,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 78: { - AddFlow(nSprite, nSpeed, 1); + AddFlow(pSprite->sectnum, nSpeed, 1, pSprite->ang); short nSector = pSprite->sectnum; SectFlag[nSector] |= 0x8000; diff --git a/source/games/exhumed/src/lighting.cpp b/source/games/exhumed/src/lighting.cpp index 931359681..04d376050 100644 --- a/source/games/exhumed/src/lighting.cpp +++ b/source/games/exhumed/src/lighting.cpp @@ -661,7 +661,7 @@ void DoFlickers() } // 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) return; @@ -672,18 +672,16 @@ void AddFlow(int nIndex, int nSpeed, int b) if (b < 2) { - int sectnum = sprite[nIndex].sectnum; - short nPic = sector[sectnum].floorpicnum; - short nAngle = sprite[nIndex].ang; + short nPic = sector[nIndex].floorpicnum; sFlowInfo[nFlow].xacc = (tileWidth(nPic) << 14) - 1; sFlowInfo[nFlow].yacc = (tileHeight(nPic) << 14) - 1; sFlowInfo[nFlow].angcos = -bcos(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(sectnum, b ? Interp_Sect_CeilingPanY : Interp_Sect_FloorPanY); + StartInterpolation(nIndex, b ? Interp_Sect_CeilingPanX : Interp_Sect_FloorPanX); + StartInterpolation(nIndex, b ? Interp_Sect_CeilingPanY : Interp_Sect_FloorPanY); } else {