diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index 08736f87b..26c20fc6b 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -302,7 +302,7 @@ struct RA TObjPtr pTarget; int16_t nAction; - int16_t nFrame; + uint16_t nFrame; int16_t nRun; int16_t nState; int nPlayer; diff --git a/source/games/exhumed/src/anubis.cpp b/source/games/exhumed/src/anubis.cpp index a50ac8c9c..3ba3f4bfc 100644 --- a/source/games/exhumed/src/anubis.cpp +++ b/source/games/exhumed/src/anubis.cpp @@ -122,20 +122,20 @@ void AIAnubis::Tick(RunListEvent* ev) { const auto ap = ev->pObjActor; const int nAction = ap->nAction; - const int nSeq = getSeqFromId(kSeqAnubis, AnubisSeq[nAction].nSeqId); - const int nFrame = getSeqFrame(nSeq, ap->nFrame); - const int nFlag = getSeqFrameFlags(nFrame); + + const auto& anubisSeq = getSequence(ap->nSeqFile, AnubisSeq[nAction].nSeqId); + const auto& seqFrame = anubisSeq[ap->nFrame]; bool bVal = false; if (nAction < 11) Gravity(ap); - seq_MoveSequence(ap, nSeq, ap->nFrame); + playFrameSound(ap, seqFrame); - ap->spr.picnum = seq_GetSeqPicnum2(nSeq, ap->nFrame); + ap->spr.picnum = seqFrame.chunks[0].picnum; ap->nFrame++; - if (ap->nFrame >= getSeqFrameCount(nSeq)) + if (ap->nFrame >= anubisSeq.Size()) { ap->nFrame = 0; bVal = true; @@ -247,7 +247,7 @@ void AIAnubis::Tick(RunListEvent* ev) { ap->nAction = 1; } - else if (nFlag & 0x80) + else if (seqFrame.flags & 0x80) { runlist_DamageEnemy(pTarget, ap, 7); } @@ -263,7 +263,7 @@ void AIAnubis::Tick(RunListEvent* ev) ap->vel.XY() = ap->spr.Angles.Yaw.ToVector() * 256; ap->nFrame = 0; } - else if (nFlag & 0x80) + else if (seqFrame.flags & 0x80) { BuildBullet(ap, 8, INT_MAX, ap->spr.Angles.Yaw, pTarget, 1); } diff --git a/source/games/exhumed/src/fish.cpp b/source/games/exhumed/src/fish.cpp index effa3dae2..08ad1031b 100644 --- a/source/games/exhumed/src/fish.cpp +++ b/source/games/exhumed/src/fish.cpp @@ -49,8 +49,9 @@ void BuildFishLimb(DExhumedActor* pActor, int anim) { auto pChunkActor = insertActor(pActor->sector(), 99); + pChunkActor->nSeqFile = "fish"; pChunkActor->nCount = anim + 40; - pChunkActor->nFrame = RandomSize(3) % getSeqFrameCount(getSeqFromId(kSeqFish, pChunkActor->nCount)); + pChunkActor->nFrame = RandomSize(3) % getSequence(pChunkActor->nSeqFile, pChunkActor->nCount).Size(); pChunkActor->spr.pos = pActor->spr.pos; pChunkActor->spr.cstat = 0; @@ -74,8 +75,6 @@ void BuildFishLimb(DExhumedActor* pActor, int anim) pChunkActor->spr.extra = -1; pChunkActor->spr.intowner = runlist_AddRunRec(pChunkActor->spr.lotag - 1, pChunkActor, 0x200000); pChunkActor->spr.hitag = runlist_AddRunRec(NewRun, pChunkActor, 0x200000); - - pChunkActor->nSeqFile = "fish"; } //--------------------------------------------------------------------------- @@ -89,15 +88,15 @@ void AIFishLimb::Tick(RunListEvent* ev) auto pActor = ev->pObjActor; if (!pActor) return; - int nSeq = getSeqFromId(kSeqFish, pActor->nCount); + const auto& fishSeq = getSequence(pActor->nSeqFile, pActor->nCount); - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); + pActor->spr.picnum = fishSeq[pActor->nFrame].chunks[0].picnum; Gravity(pActor); pActor->nFrame++; - if (pActor->nFrame >= getSeqFrameCount(nSeq)) + if (pActor->nFrame >= fishSeq.Size()) { pActor->nFrame = 0; if (RandomBit()) { @@ -360,14 +359,15 @@ void AIFish::Tick(RunListEvent* ev) Gravity(pActor); } - int nSeq = getSeqFromId(kSeqFish, FishSeq[nAction].nSeqId); + const auto& fishSeq = getSequence(pActor->nSeqFile, FishSeq[nAction].nSeqId); + const auto& seqFrame = fishSeq[pActor->nFrame]; - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; - seq_MoveSequence(pActor, nSeq, pActor->nFrame); + playFrameSound(pActor, seqFrame); pActor->nFrame++; - if (pActor->nFrame >= getSeqFrameCount(nSeq)) { + if (pActor->nFrame >= fishSeq.Size()) { pActor->nFrame = 0; } diff --git a/source/games/exhumed/src/grenade.cpp b/source/games/exhumed/src/grenade.cpp index d1d45294a..3915cf436 100644 --- a/source/games/exhumed/src/grenade.cpp +++ b/source/games/exhumed/src/grenade.cpp @@ -258,10 +258,11 @@ void AIGrenade::Tick(RunListEvent* ev) auto pActor = ev->pObjActor; if (!pActor) return; - int nSeq = pActor->nFrame ? getSeqFromId(kSeqGrenBoom) : getSeqFromId(kSeqGrenRoll, pActor->nIndex); + const auto& grenadeSeq = pActor->nFrame ? getSequence("grenboom") : getSequence("grenroll", pActor->nIndex); + const auto& seqFrame = grenadeSeq[pActor->nHealth >> 8]; - seq_MoveSequence(pActor, nSeq, pActor->nHealth >> 8); - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nHealth >> 8); + playFrameSound(pActor, seqFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; pActor->nIndex2--; if (!pActor->nIndex2) @@ -301,11 +302,11 @@ void AIGrenade::Tick(RunListEvent* ev) if (ebp < 0) { - pActor->nHealth += getSeqFrameCount(nSeq) << 8; + pActor->nHealth += grenadeSeq.Size() << 8; } else { - if (ebp >= getSeqFrameCount(nSeq)) + if (ebp >= (signed)grenadeSeq.Size()) { if (pActor->nFrame) { diff --git a/source/games/exhumed/src/lavadude.cpp b/source/games/exhumed/src/lavadude.cpp index 1d4ed857c..8ebb5df57 100644 --- a/source/games/exhumed/src/lavadude.cpp +++ b/source/games/exhumed/src/lavadude.cpp @@ -214,21 +214,20 @@ void AILavaDude::Tick(RunListEvent* ev) if (!pActor) return; int nAction = pActor->nAction; - int nSeq = getSeqFromId(kSeqLavag, LavadudeSeq[nAction].nSeqId); - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); - int var_38 = pActor->nFrame; + const auto& lavadudeSeq = getSequence(pActor->nSeqFile, LavadudeSeq[nAction].nSeqId); + const auto& seqFrame = lavadudeSeq[pActor->nFrame]; - int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, var_38)); + pActor->spr.picnum = seqFrame.chunks[0].picnum; int var_1C = 0; if (nAction) { - seq_MoveSequence(pActor, nSeq, var_38); + playFrameSound(pActor, seqFrame); pActor->nFrame++; - if (pActor->nFrame >= getSeqFrameCount(nSeq)) + if (pActor->nFrame >= lavadudeSeq.Size()) { var_1C = 1; pActor->nFrame = 0; @@ -341,7 +340,7 @@ void AILavaDude::Tick(RunListEvent* ev) case 3: { - if ((nFlag & 0x80) && pTarget) + if ((seqFrame.flags & 0x80) && pTarget) { BuildBullet(pActor, 10, INT_MAX, pActor->spr.Angles.Yaw, pTarget, 1); } @@ -368,7 +367,7 @@ void AILavaDude::Tick(RunListEvent* ev) case 5: { - if (nFlag & 0x40) + if (seqFrame.flags & 0x40) { auto pLimbSprite = BuildLavaLimb(pActor, pActor->nFrame, 250); D3PlayFX(StaticSound[kSound26], pLimbSprite); @@ -376,7 +375,7 @@ void AILavaDude::Tick(RunListEvent* ev) if (pActor->nFrame) { - if (nFlag & 0x80) + if (seqFrame.flags & 0x80) { int ecx = 0; do diff --git a/source/games/exhumed/src/lion.cpp b/source/games/exhumed/src/lion.cpp index 87dc96f9e..48c7f7c2b 100644 --- a/source/games/exhumed/src/lion.cpp +++ b/source/games/exhumed/src/lion.cpp @@ -200,20 +200,20 @@ void AILion::Tick(RunListEvent* ev) Gravity(pActor); } - int nSeq = getSeqFromId(kSeqLion, LionSeq[nAction].nSeqId); + const auto& lionSeq = getSequence(pActor->nSeqFile, LionSeq[nAction].nSeqId); + const auto& seqFrame = lionSeq[pActor->nFrame]; - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; - seq_MoveSequence(pActor, nSeq, pActor->nFrame); + playFrameSound(pActor, seqFrame); pActor->nFrame++; - if (pActor->nFrame >= getSeqFrameCount(nSeq)) + if (pActor->nFrame >= lionSeq.Size()) { pActor->nFrame = 0; bVal = true; } - int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, pActor->nFrame)); DExhumedActor* pTarget = pActor->pTarget; auto nMov = MoveCreatureWithCaution(pActor); @@ -338,7 +338,7 @@ void AILion::Tick(RunListEvent* ev) { pActor->nAction = 2; } - else if (nFlag & 0x80) + else if (seqFrame.flags & 0x80) { runlist_DamageEnemy(pTarget, pActor, 10); } diff --git a/source/games/exhumed/src/mummy.cpp b/source/games/exhumed/src/mummy.cpp index 2be010824..4b7450375 100644 --- a/source/games/exhumed/src/mummy.cpp +++ b/source/games/exhumed/src/mummy.cpp @@ -141,19 +141,17 @@ void AIMummy::Tick(RunListEvent* ev) Gravity(pActor); - int nSeq = getSeqFromId(kSeqMummy, MummySeq[nAction].nSeqId); + const auto& mummySeq = getSequence(pActor->nSeqFile, MummySeq[nAction].nSeqId); + const auto& seqFrame = mummySeq[pActor->nFrame]; - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; - int nFrame = getSeqFrame(nSeq, pActor->nFrame); - int nFrameFlag = getSeqFrameFlags(nFrame); - - seq_MoveSequence(pActor, nSeq, pActor->nFrame); + playFrameSound(pActor, seqFrame); bool bVal = false; pActor->nFrame++; - if (pActor->nFrame >= getSeqFrameCount(nSeq)) + if (pActor->nFrame >= mummySeq.Size()) { pActor->nFrame = 0; @@ -316,7 +314,7 @@ void AIMummy::Tick(RunListEvent* ev) pActor->nAction = 1; pActor->nFrame = 0; } - else if (nFrameFlag & 0x80) + else if (seqFrame.flags & 0x80) { runlist_DamageEnemy(pTarget, pActor, 5); } @@ -334,7 +332,7 @@ void AIMummy::Tick(RunListEvent* ev) pActor->pTarget = nullptr; return; } - else if (nFrameFlag & 0x80) + else if (seqFrame.flags & 0x80) { SetQuake(pActor, 100); diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index b0a2612ac..ac74c88db 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -2178,13 +2178,9 @@ void DoDrips() { DExhumedActor* pActor = sDrip[i].pActor; if (!pActor) continue; - int nSeqOffset = getSeqFromId(kSeqDrips); - if (!(pActor->sector()->Flag & kSectLava)) { - nSeqOffset++; - } - - seq_MoveSequence(pActor, nSeqOffset, RandomSize(2) % getSeqFrameCount(nSeqOffset)); + const auto& dripSeq = getSequence("drips", !(pActor->sector()->Flag & kSectLava)); + playFrameSound(pActor, dripSeq[RandomSize(2) % dripSeq.Size()]); sDrip[i].nCount = RandomSize(8) + 90; } diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 1fd2c2c84..5e563ad73 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -1916,12 +1916,15 @@ static bool doPlayerDeathRestart(Player* const pPlayer) static void doPlayerActionSequence(Player* const pPlayer) { const auto pPlayerActor = pPlayer->pActor; - const auto nSeq = getSeqFromId(pPlayer->nSeq, PlayerSeq[pPlayer->nAction].nSeqId); - seq_MoveSequence(pPlayerActor, nSeq, pPlayer->nSeqSize); + const auto& playerSeq = getSequence(pPlayerActor->nSeqFile, PlayerSeq[pPlayer->nAction].nSeqId); + const auto& seqFrame = playerSeq[pPlayer->nSeqSize]; + const auto seqSize = playerSeq.Size(); + + playFrameSound(pPlayerActor, seqFrame); pPlayer->nSeqSize++; - if (pPlayer->nSeqSize < getSeqFrameCount(nSeq)) + if (pPlayer->nSeqSize < seqSize) return; pPlayer->nSeqSize = 0; @@ -1931,13 +1934,13 @@ static void doPlayerActionSequence(Player* const pPlayer) default: break; case 3: - pPlayer->nSeqSize = getSeqFrameCount(nSeq) - 1; + pPlayer->nSeqSize = seqSize - 1; break; case 4: pPlayer->nAction = 0; break; case 16: - pPlayer->nSeqSize = getSeqFrameCount(nSeq) - 1; + pPlayer->nSeqSize = seqSize - 1; if (pPlayerActor->spr.pos.Z < pPlayerActor->sector()->floorz) pPlayerActor->spr.pos.Z++; diff --git a/source/games/exhumed/src/player.h b/source/games/exhumed/src/player.h index 0ae1f8278..01e13b8ca 100644 --- a/source/games/exhumed/src/player.h +++ b/source/games/exhumed/src/player.h @@ -55,7 +55,7 @@ struct Player int16_t nDouble; int16_t nInvisible; int16_t nTorch; - int16_t nSeqSize; + uint16_t nSeqSize; int16_t nAction; int16_t bIsMummified; int16_t invincibility; diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index 590131f1f..616069fc9 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -73,7 +73,7 @@ struct Queen TObjPtr pActor; TObjPtr pTarget; int16_t nHealth; - int16_t nFrame; + uint16_t nFrame; int16_t nAction; int16_t nAction2; int16_t nIndex; @@ -86,7 +86,7 @@ struct Egg TObjPtr pActor; TObjPtr pTarget; int16_t nHealth; - int16_t nFrame; + uint16_t nFrame; int16_t nAction; int16_t nRun; int16_t nCounter; @@ -97,7 +97,7 @@ struct Head TObjPtr pActor; TObjPtr pTarget; int16_t nHealth; - int16_t nFrame; + uint16_t nFrame; int16_t nAction; int16_t nRun; int16_t nIndex; @@ -543,16 +543,17 @@ void AIQueenEgg::Tick(RunListEvent* ev) Gravity(pActor); } - int nSeq = getSeqFromId(kSeqQueenEgg, EggSeq[nAction].nSeqId); + const auto& eggSeq = getSequence(pActor->nSeqFile, EggSeq[nAction].nSeqId); + const auto& seqFrame = eggSeq[pEgg->nFrame]; - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pEgg->nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; if (nAction != 4) { - seq_MoveSequence(pActor, nSeq, pEgg->nFrame); + playFrameSound(pActor, seqFrame); pEgg->nFrame++; - if (pEgg->nFrame >= getSeqFrameCount(nSeq)) + if (pEgg->nFrame >= eggSeq.Size()) { pEgg->nFrame = 0; bVal = true; @@ -801,14 +802,15 @@ void AIQueenHead::Tick(RunListEvent* ev) Gravity(pActor); } - int nSeq = getSeqFromId(kSeqQueen, HeadSeq[QueenHead.nAction].nSeqId); + const auto& queenSeq = getSequence(pActor->nSeqFile, HeadSeq[QueenHead.nAction].nSeqId); + const auto& seqFrame = queenSeq[QueenHead.nFrame]; - seq_MoveSequence(pActor, nSeq, QueenHead.nFrame); + playFrameSound(pActor, seqFrame); - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, QueenHead.nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; QueenHead.nFrame++; - if (QueenHead.nFrame >= getSeqFrameCount(nSeq)) + if (QueenHead.nFrame >= queenSeq.Size()) { QueenHead.nFrame = 0; var_14 = 1; @@ -1233,21 +1235,20 @@ void AIQueen::Tick(RunListEvent* ev) Gravity(pActor); } - int nSeq = getSeqFromId(kSeqQueen, QueenSeq[nAction].nSeqId); + const auto& queenSeq = getSequence(pActor->nSeqFile, QueenSeq[nAction].nSeqId); + const auto& seqFrame = queenSeq[QueenList[nQueen].nFrame]; - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, QueenList[nQueen].nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; - seq_MoveSequence(pActor, nSeq, QueenList[nQueen].nFrame); + playFrameSound(pActor, seqFrame); QueenList[nQueen].nFrame++; - if (QueenList[nQueen].nFrame >= getSeqFrameCount(nSeq)) + if (QueenList[nQueen].nFrame >= queenSeq.Size()) { QueenList[nQueen].nFrame = 0; bVal = true; } - int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, QueenList[nQueen].nFrame)); - if (pActor != nullptr) { if (nAction < 7) @@ -1392,7 +1393,7 @@ void AIQueen::Tick(RunListEvent* ev) } else { - if (nFlag & 0x80) + if (seqFrame.flags & 0x80) { QueenList[nQueen].nIndex2--; diff --git a/source/games/exhumed/src/ra.cpp b/source/games/exhumed/src/ra.cpp index f140f15a5..0252ce4b9 100644 --- a/source/games/exhumed/src/ra.cpp +++ b/source/games/exhumed/src/ra.cpp @@ -210,21 +210,23 @@ void AIRa::Tick(RunListEvent* ev) int nPlayer = RunData[ev->nRun].nObjIndex; int nCurrentWeapon = PlayerList[nPlayer].nCurrentWeapon; - int nSeq = getSeqFromId(kSeqEyeHit, RaSeq[Ra[nPlayer].nAction].nSeqId); DExhumedActor* pActor = Ra[nPlayer].pActor; if (!pActor) return; + const auto& raSeq = getSequence(Ra[nPlayer].pActor->nSeqFile, RaSeq[Ra[nPlayer].nAction].nSeqId); + const auto& seqFrame = raSeq[Ra[nPlayer].nFrame]; + bool bVal = false; Ra[nPlayer].pTarget = PlayerList[nPlayer].pTarget; - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, Ra[nPlayer].nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; if (Ra[nPlayer].nAction) { - seq_MoveSequence(pActor, nSeq, Ra[nPlayer].nFrame); + playFrameSound(pActor, seqFrame); Ra[nPlayer].nFrame++; - if (Ra[nPlayer].nFrame >= getSeqFrameCount(nSeq)) + if (Ra[nPlayer].nFrame >= raSeq.Size()) { Ra[nPlayer].nFrame = 0; bVal = true; diff --git a/source/games/exhumed/src/rat.cpp b/source/games/exhumed/src/rat.cpp index e521f833b..80dad7708 100644 --- a/source/games/exhumed/src/rat.cpp +++ b/source/games/exhumed/src/rat.cpp @@ -246,13 +246,15 @@ void AIRat::Tick(RunListEvent* ev) bool bVal = false; - int nSeq = getSeqFromId(kSeqRat, RatSeq[nAction].nSeqId); - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); + const auto& ratSeq = getSequence(pActor->nSeqFile, RatSeq[nAction].nSeqId); + const auto& seqFrame = ratSeq[pActor->nFrame]; - seq_MoveSequence(pActor, nSeq, pActor->nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; + + playFrameSound(pActor, seqFrame); pActor->nFrame++; - if (pActor->nFrame >= getSeqFrameCount(nSeq)) + if (pActor->nFrame >= ratSeq.Size()) { bVal = true; pActor->nFrame = 0; diff --git a/source/games/exhumed/src/rex.cpp b/source/games/exhumed/src/rex.cpp index f583cb680..171f4ae34 100644 --- a/source/games/exhumed/src/rex.cpp +++ b/source/games/exhumed/src/rex.cpp @@ -192,9 +192,10 @@ void AIRex::Tick(RunListEvent* ev) Gravity(pActor); - int nSeq = getSeqFromId(kSeqRex, RexSeq[nAction].nSeqId); + const auto& rexSeq = getSequence(pActor->nSeqFile, RexSeq[nAction].nSeqId); + const auto& seqFrame = rexSeq[pActor->nFrame]; - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; int ecx = 2; @@ -205,18 +206,16 @@ void AIRex::Tick(RunListEvent* ev) // moves the mouth open and closed as it's idle? while (--ecx != -1) { - seq_MoveSequence(pActor, nSeq, pActor->nFrame); + playFrameSound(pActor, seqFrame); pActor->nFrame++; - if (pActor->nFrame >= getSeqFrameCount(nSeq)) + if (pActor->nFrame >= rexSeq.Size()) { pActor->nFrame = 0; bVal = true; } } - int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, pActor->nFrame)); - DExhumedActor* pTarget = pActor->pTarget; switch (nAction) @@ -405,7 +404,7 @@ void AIRex::Tick(RunListEvent* ev) { if (PlotCourseToSprite(pActor, pTarget) < 48) { - if (nFlag & 0x80) + if (seqFrame.flags & 0x80) { runlist_DamageEnemy(pTarget, pActor, 15); } diff --git a/source/games/exhumed/src/roach.cpp b/source/games/exhumed/src/roach.cpp index 014654fe7..75a862ac4 100644 --- a/source/games/exhumed/src/roach.cpp +++ b/source/games/exhumed/src/roach.cpp @@ -212,19 +212,19 @@ void AIRoach::Tick(RunListEvent* ev) Gravity(pActor); - int nSeq = getSeqFromId(kSeqRoach, RoachSeq[nAction].nSeqId); + const auto& roachSeq = getSequence(pActor->nSeqFile, RoachSeq[nAction].nSeqId); + const auto& seqFrame = roachSeq[pActor->nFrame]; - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); - seq_MoveSequence(pActor, nSeq, pActor->nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; + playFrameSound(pActor, seqFrame); pActor->nFrame++; - if (pActor->nFrame >= getSeqFrameCount(nSeq)) + if (pActor->nFrame >= roachSeq.Size()) { bVal = true; pActor->nFrame = 0; } - int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, pActor->nFrame)); DExhumedActor* pTarget = pActor->pTarget; if (nAction > 5) { @@ -364,7 +364,7 @@ void AIRoach::Tick(RunListEvent* ev) } else { - if (nFlag & 0x80) + if (seqFrame.flags & 0x80) { BuildBullet(pActor, 13, INT_MAX, pActor->spr.Angles.Yaw, pTarget, 1); } diff --git a/source/games/exhumed/src/scorp.cpp b/source/games/exhumed/src/scorp.cpp index 779618a4a..1d2e73d3a 100644 --- a/source/games/exhumed/src/scorp.cpp +++ b/source/games/exhumed/src/scorp.cpp @@ -207,20 +207,20 @@ void AIScorp::Tick(RunListEvent* ev) Gravity(pActor); } - int nSeq = getSeqFromId(kSeqScorp, ScorpSeq[nAction].nSeqId); + const auto& scorpSeq = getSequence(pActor->nSeqFile, ScorpSeq[nAction].nSeqId); + const auto& seqFrame = scorpSeq[pActor->nFrame]; - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); - seq_MoveSequence(pActor, nSeq, pActor->nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; + playFrameSound(pActor, seqFrame); pActor->nFrame++; - if (pActor->nFrame >= getSeqFrameCount(nSeq)) + if (pActor->nFrame >= scorpSeq.Size()) { pActor->nFrame = 0; bVal = true; } - int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, pActor->nFrame)); pTarget = pActor->pTarget; switch (nAction) @@ -313,7 +313,7 @@ void AIScorp::Tick(RunListEvent* ev) { pActor->nAction = 1; } - else if (nFlag & 0x80) + else if (seqFrame.flags & 0x80) { runlist_DamageEnemy(pTarget, pActor, 7); } @@ -338,7 +338,7 @@ void AIScorp::Tick(RunListEvent* ev) } } - if (!(nFlag & 0x80)) { + if (!(seqFrame.flags & 0x80)) { return; } diff --git a/source/games/exhumed/src/set.cpp b/source/games/exhumed/src/set.cpp index 6b8c4e69b..ed9bd8743 100644 --- a/source/games/exhumed/src/set.cpp +++ b/source/games/exhumed/src/set.cpp @@ -144,7 +144,7 @@ void AISoul::Tick(RunListEvent* ev) auto pActor = ev->pObjActor; if (!pActor) return; - seq_MoveSequence(pActor, getSeqFromId(kSeqSet, 75), 0); + playFrameSound(pActor, getSequence("set", 75)[0]); if (pActor->spr.scale.X < 0.5) { @@ -270,9 +270,11 @@ void AISet::Tick(RunListEvent* ev) Gravity(pActor); - int nSeq = getSeqFromId(kSeqSet, SetSeq[nAction].nSeqId); - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); - seq_MoveSequence(pActor, nSeq, pActor->nFrame); + const auto& setSeq = getSequence(pActor->nSeqFile, SetSeq[nAction].nSeqId); + const auto& seqFrame = setSeq[pActor->nFrame]; + + pActor->spr.picnum = seqFrame.chunks[0].picnum; + playFrameSound(pActor, seqFrame); if (nAction == 3) { @@ -282,13 +284,12 @@ void AISet::Tick(RunListEvent* ev) } pActor->nFrame++; - if (pActor->nFrame >= getSeqFrameCount(nSeq)) + if (pActor->nFrame >= setSeq.Size()) { pActor->nFrame = 0; bVal = true; } - int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, pActor->nFrame)); DExhumedActor* pTarget = pActor->pTarget; if (pTarget && nAction < 10) @@ -378,7 +379,7 @@ void AISet::Tick(RunListEvent* ev) { if (pTarget != nullptr) { - if ((nFlag & 0x10) && (nMov.exbits & kHitAux2)) + if ((seqFrame.flags & 0x10) && (nMov.exbits & kHitAux2)) { SetQuake(pActor, 100); } @@ -506,7 +507,7 @@ void AISet::Tick(RunListEvent* ev) { pActor->nAction = 3; } - else if (nFlag & 0x80) + else if (seqFrame.flags & 0x80) { runlist_DamageEnemy(pTarget, pActor, 5); } @@ -527,7 +528,7 @@ void AISet::Tick(RunListEvent* ev) case 6: { - if (nFlag & 0x80) + if (seqFrame.flags & 0x80) { auto pBullet = BuildBullet(pActor, 11, INT_MAX, pActor->spr.Angles.Yaw, pTarget, 1); if (pBullet) @@ -568,7 +569,7 @@ void AISet::Tick(RunListEvent* ev) { if (bVal) { - pActor->nFrame = getSeqFrameCount(nSeq) - 1; + pActor->nFrame = setSeq.Size() - 1; } if (nMov.exbits & kHitAux2) @@ -604,7 +605,7 @@ void AISet::Tick(RunListEvent* ev) case 10: { - if (nFlag & 0x80) + if (seqFrame.flags & 0x80) { pActor->spr.pos.Z -= GetActorHeight(pActor); BuildCreatureChunk(pActor, seq_GetSeqPicnum(kSeqSet, 76, 0)); diff --git a/source/games/exhumed/src/snake.cpp b/source/games/exhumed/src/snake.cpp index 85c006590..f74112668 100644 --- a/source/games/exhumed/src/snake.cpp +++ b/source/games/exhumed/src/snake.cpp @@ -339,7 +339,7 @@ void AISnake::Tick(RunListEvent* ev) DExhumedActor* pActor = SnakeList[nSnake].pSprites[0]; if (!pActor) return; - seq_MoveSequence(pActor, getSeqFromId(kSeqSnakehed), 0); + playFrameSound(pActor, getSequence("snakehed")[0]); DExhumedActor* pEnemySprite = SnakeList[nSnake].pEnemy; diff --git a/source/games/exhumed/src/sound.cpp b/source/games/exhumed/src/sound.cpp index 707b33036..2de1cf569 100644 --- a/source/games/exhumed/src/sound.cpp +++ b/source/games/exhumed/src/sound.cpp @@ -718,8 +718,9 @@ void UpdateCreepySounds() { if (nCreaturesKilled < nCreaturesTotal && !(PlayerList[nLocalPlayer].pPlayerViewSect->Flag & 0x2000)) { - int vsi = seq_GetFrameSound(getSeqFromId(kSeqCreepy), totalmoves % getSeqFrameCount(getSeqFromId(kSeqCreepy))); - if (vsi >= 0 && (vsi & 0x1ff) < kMaxSounds) + const auto& creepySeq = getSequence("creepy"); + const auto seqFrameSound = creepySeq[totalmoves % creepySeq.Size()].sound; + if (seqFrameSound >= 0 && (seqFrameSound & 0x1ff) < kMaxSounds) { DVector2 adder; adder.X = ((totalmoves + 32) & 31) / 16.; @@ -732,7 +733,7 @@ void UpdateCreepySounds() auto sp = PlayerList[nLocalPlayer].pActor->spr.pos + adder; creepy = GetSoundPos(sp); - auto soundid = FSoundID::fromInt((vsi & 0x1ff) + 1); + auto soundid = FSoundID::fromInt((seqFrameSound & 0x1ff) + 1); if (!soundEngine->isValidSoundId(soundid)) { @@ -740,8 +741,7 @@ void UpdateCreepySounds() } int nVolume = 255; - int v10 = (vsi & 0xe00) >> 9; - vsi &= 0x1ff; + int v10 = (seqFrameSound & 0xe00) >> 9; int nPitch = 0; if (v10) nPitch = -(totalmoves & ((1 << v10) - 1)) * 16; diff --git a/source/games/exhumed/src/spider.cpp b/source/games/exhumed/src/spider.cpp index dd61dfb86..974ae40f0 100644 --- a/source/games/exhumed/src/spider.cpp +++ b/source/games/exhumed/src/spider.cpp @@ -119,16 +119,15 @@ void AISpider::Tick(RunListEvent* ev) } } - int nSeq = getSeqFromId(kSeqSpider, SpiderSeq[nAction].nSeqId); + const auto& spiderSeq = getSequence(spp->nSeqFile, SpiderSeq[nAction].nSeqId); + const auto& seqFrame = spiderSeq[spp->nFrame]; - spp->spr.picnum = seq_GetSeqPicnum2(nSeq, spp->nFrame); + spp->spr.picnum = seqFrame.chunks[0].picnum; - seq_MoveSequence(spp, nSeq, spp->nFrame); - - int nFrameFlag = getSeqFrameFlags(getSeqFrame(nSeq, spp->nFrame)); + playFrameSound(spp, seqFrame); spp->nFrame++; - if (spp->nFrame >= getSeqFrameCount(nSeq)) { + if (spp->nFrame >= spiderSeq.Size()) { spp->nFrame = 0; } @@ -253,7 +252,7 @@ void AISpider::Tick(RunListEvent* ev) { if (pTarget) { - if (nFrameFlag & 0x80) + if (seqFrame.flags & 0x80) { runlist_DamageEnemy(pTarget, spp, 3); D3PlayFX(StaticSound[kSound38], spp); diff --git a/source/games/exhumed/src/wasp.cpp b/source/games/exhumed/src/wasp.cpp index cf96f446c..5042bf245 100644 --- a/source/games/exhumed/src/wasp.cpp +++ b/source/games/exhumed/src/wasp.cpp @@ -215,14 +215,15 @@ void AIWasp::Tick(RunListEvent* ev) bool bVal = false; - int nSeq = getSeqFromId(kSeqWasp, WaspSeq[nAction].nSeqId); + const auto& waspSeq = getSequence(pActor->nSeqFile, WaspSeq[nAction].nSeqId); + const auto& seqFrame = waspSeq[pActor->nFrame]; - pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); + pActor->spr.picnum = seqFrame.chunks[0].picnum; - seq_MoveSequence(pActor, nSeq, pActor->nFrame); + playFrameSound(pActor, seqFrame); pActor->nFrame++; - if (pActor->nFrame >= getSeqFrameCount(nSeq)) + if (pActor->nFrame >= waspSeq.Size()) { pActor->nFrame = 0; bVal = true;