From 43e849ca4024067652ddc5b328964fb09ef12763 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 24 Oct 2021 19:18:11 +0200 Subject: [PATCH] - BuildSplash and BuildExplosion. --- source/games/exhumed/src/aistuff.h | 5 +++-- source/games/exhumed/src/anims.cpp | 10 ++++------ source/games/exhumed/src/bullet.cpp | 6 +++--- source/games/exhumed/src/move.cpp | 2 +- source/games/exhumed/src/queen.cpp | 8 ++++---- source/games/exhumed/src/wasp.cpp | 2 +- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index d42a77533..7158ce0ee 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -50,8 +50,9 @@ int BuildAnim(DExhumedActor* nSprite, int val, int val2, int x, int y, int z, in short GetAnimSprite(short nAnim); void FuncAnim(int, int, int, int); -void BuildExplosion(short nSprite); -int BuildSplash(int nSprite, int nSector); +void BuildExplosion(DExhumedActor* actor); +void BuildSplash(DExhumedActor* actor, int nSector); + // anubis diff --git a/source/games/exhumed/src/anims.cpp b/source/games/exhumed/src/anims.cpp index 7c6970484..c5a0e3a24 100644 --- a/source/games/exhumed/src/anims.cpp +++ b/source/games/exhumed/src/anims.cpp @@ -278,9 +278,9 @@ void FuncAnim(int nObject, int nMessage, int nDamage, int nRun) runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun); } -void BuildExplosion(short nSprite) +void BuildExplosion(DExhumedActor* pActor) { - auto pSprite = &sprite[nSprite]; + auto pSprite = &pActor->s(); short nSector = pSprite->sectnum; @@ -298,9 +298,9 @@ void BuildExplosion(short nSprite) BuildAnim(nullptr, edx, 0, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, pSprite->xrepeat, 4); } -int BuildSplash(int nSprite, int nSector) +void BuildSplash(DExhumedActor* actor, int nSector) { - auto pSprite = &sprite[nSprite]; + auto pSprite = &actor->s(); int nRepeat, nSound; if (pSprite->statnum != 200) @@ -335,7 +335,5 @@ int BuildSplash(int nSprite, int nSector) { D3PlayFX(StaticSound[nSound] | 0xa00, pActor); } - - return AnimList[nAnim].nSprite; } END_PS_NS diff --git a/source/games/exhumed/src/bullet.cpp b/source/games/exhumed/src/bullet.cpp index d1c9ad110..1a1a96ccc 100644 --- a/source/games/exhumed/src/bullet.cpp +++ b/source/games/exhumed/src/bullet.cpp @@ -200,7 +200,7 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in } if (!RandomSize(2)) { - BuildAnim(-1, pBulletInfo->field_C, 0, x, y, z, nSector, 40, pBulletInfo->nFlags); + BuildAnim(nullptr, pBulletInfo->field_C, 0, x, y, z, nSector, 40, pBulletInfo->nFlags); } return; @@ -496,7 +496,7 @@ HITWALL: pSprite->x = x2; pSprite->y = y2; pSprite->z = z2; - BuildSplash(nSprite, hitsect); + BuildSplash(&exhumedActors[nSprite], hitsect); } else { @@ -826,7 +826,7 @@ void AIBullet::Tick(RunListEvent* ev) if (nFlag & 0x80) { - BuildAnim(-1, 45, 0, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, pSprite->xrepeat, 0); + BuildAnim(nullptr, 45, 0, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, pSprite->xrepeat, 0); } BulletList[nBullet].nFrame++; diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 270ae2af4..fc7bbb54b 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -499,7 +499,7 @@ int movespritez(short nSprite, int z, int height, int, int clipdist) if ((SectDepth[nSector] != 0) || (edi != nSector && (SectFlag[edi] & kSectUnderwater))) { assert(nSector >= 0 && nSector < kMaxSectors); - BuildSplash(nSprite, nSector); + BuildSplash(&exhumedActors[nSprite], nSector); } } diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index bc05b91bc..e22f1a5c0 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -369,7 +369,7 @@ int DestroyTailPart() short nSprite = tailspr[--QueenHead.tails]; BlowChunks(nSprite); - BuildExplosion(nSprite); + BuildExplosion(&exhumedActors[nSprite]); for (int i = 0; i < 5; i++) { @@ -1018,7 +1018,7 @@ void AIQueenHead::Tick(RunListEvent* ev) movesprite(nSprite, dx, dy, dz, 0, 0, CLIPMASK1); BlowChunks(nSprite); - BuildExplosion(nSprite); + BuildExplosion(&exhumedActors[nSprite]); mychangespritesect(nSprite, nSector); @@ -1036,7 +1036,7 @@ void AIQueenHead::Tick(RunListEvent* ev) } else { - BuildExplosion(nSprite); + BuildExplosion(&exhumedActors[nSprite]); int i; @@ -1521,7 +1521,7 @@ void AIQueen::Damage(RunListEvent* ev) QueenList[nQueen].nHealth = 4000; QueenList[nQueen].nAction = 7; - BuildAnim(-1, 36, 0, pSprite->x, pSprite->y, pSprite->z - 7680, pSprite->sectnum, pSprite->xrepeat, 4); + BuildAnim(nullptr, 36, 0, pSprite->x, pSprite->y, pSprite->z - 7680, pSprite->sectnum, pSprite->xrepeat, 4); break; case 2: QueenList[nQueen].nHealth = 4000; diff --git a/source/games/exhumed/src/wasp.cpp b/source/games/exhumed/src/wasp.cpp index f01b8deee..6ae6ddc53 100644 --- a/source/games/exhumed/src/wasp.cpp +++ b/source/games/exhumed/src/wasp.cpp @@ -347,7 +347,7 @@ void AIWasp::Tick(RunListEvent* ev) { if (SectBelow[nSector] > -1) { - BuildSplash(pActor->GetSpriteIndex(), nSector); + BuildSplash(pActor, nSector); pSprite->cstat |= 0x8000; }