From cd4090e53130f555f757b0fae186a8bab65e6945 Mon Sep 17 00:00:00 2001 From: sirlemonhead Date: Thu, 27 Feb 2020 01:03:13 +0000 Subject: [PATCH] PCExhumed: Fix Anubis drum not moving correctly when shot (bad angle calc). --- source/exhumed/src/anubis.cpp | 16 +++++----- source/exhumed/src/bullet.cpp | 56 +++++++++++++++++------------------ source/exhumed/src/object.cpp | 4 +-- source/exhumed/src/object.h | 2 +- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/source/exhumed/src/anubis.cpp b/source/exhumed/src/anubis.cpp index ff8e37593..5fdcdd4b0 100644 --- a/source/exhumed/src/anubis.cpp +++ b/source/exhumed/src/anubis.cpp @@ -447,16 +447,16 @@ void FuncAnubis(int a, int nDamage, int nRun) { if (nAction >= 6 && nAction <= 10) { - int nThisSprite = insertsprite(sprite[nSprite].sectnum, 98); + int nDrumSprite = insertsprite(sprite[nSprite].sectnum, kStatAnubisDrum); - sprite[nThisSprite].x = sprite[nSprite].x; - sprite[nThisSprite].y = sprite[nSprite].y; - sprite[nThisSprite].z = sector[sprite[nThisSprite].sectnum].floorz; - sprite[nThisSprite].xrepeat = 40; - sprite[nThisSprite].yrepeat = 40; - sprite[nThisSprite].shade = -64; + sprite[nDrumSprite].x = sprite[nSprite].x; + sprite[nDrumSprite].y = sprite[nSprite].y; + sprite[nDrumSprite].z = sector[sprite[nDrumSprite].sectnum].floorz; + sprite[nDrumSprite].xrepeat = 40; + sprite[nDrumSprite].yrepeat = 40; + sprite[nDrumSprite].shade = -64; - BuildObject(nThisSprite, 2, 0); + BuildObject(nDrumSprite, 2, 0); } AnubisList[nAnubis].nAction = 4; diff --git a/source/exhumed/src/bullet.cpp b/source/exhumed/src/bullet.cpp index 4a074e5ac..ab301c836 100644 --- a/source/exhumed/src/bullet.cpp +++ b/source/exhumed/src/bullet.cpp @@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "gun.h" #include "names.h" #include "lighting.h" +#include "object.h" #include #include #ifndef __WATCOMC__ @@ -150,7 +151,7 @@ void IgniteSprite(int nSprite) { sprite[nSprite].hitag += 2; - int nAnim = BuildAnim(-1, 38, 0, sprite[nSprite].x, sprite[nSprite].y, sprite[nSprite].z, sprite[nSprite].sectnum, 40, 20);//276); + int nAnim = BuildAnim(-1, 38, 0, sprite[nSprite].x, sprite[nSprite].y, sprite[nSprite].z, sprite[nSprite].sectnum, 40, 20); short nAnimSprite = GetAnimSprite(nAnim); sprite[nAnimSprite].hitag = nSprite; @@ -175,7 +176,7 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in { case 3: { - if (nStat > 107 || nStat == 98) { + if (nStat > 107 || nStat == kStatAnubisDrum) { return; } @@ -193,7 +194,7 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in } case 14: { - if (nStat > 107 || nStat == 98) { + if (nStat > 107 || nStat == kStatAnubisDrum) { return; } // else - fall through to below cases @@ -217,7 +218,15 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in spritetype *pSprite = &sprite[nSprite]; spritetype *pHitSprite = &sprite[nHitSprite]; - if (nStat != 98) + if (nStat == kStatAnubisDrum) + { + short nAngle = (pSprite->ang + 256) - RandomSize(9); + + pHitSprite->xvel = Cos(nAngle) << 1; + pHitSprite->yvel = Sin(nAngle) << 1; + pHitSprite->zvel = (-(RandomSize(3) + 1)) << 8; + } + else { int xVel = pHitSprite->xvel; int yVel = pHitSprite->yvel; @@ -230,14 +239,6 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in pHitSprite->xvel = xVel; pHitSprite->yvel = yVel; } - else - { - short nAngle = pSprite->ang - (RandomSize(9) - 256); - - pHitSprite->xvel = Cos(nAngle) << 1; - pHitSprite->yvel = Sin(nAngle) << 1; - pHitSprite->zvel = (-(RandomSize(3) + 1)) << 8; - } break; } @@ -263,22 +264,21 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in switch (nStat) { - case 97: - break; - case 0: - case 98: - case 102: - case 141: - case 152: - BuildAnim(-1, 12, 0, x, y, z, nSector, 40, 0); - break; - default: - BuildAnim(-1, 39, 0, x, y, z, nSector, 40, 0); - if (pBullet->nType > 2) - { - BuildAnim(-1, pBulletInfo->field_C, 0, x, y, z, nSector, 40, pBulletInfo->nFlags); - } - break; + case kStatDestructibleSprite: + break; + case kStatAnubisDrum: + case 102: + case kStatExplodeTrigger: + case kStatExplodeTarget: + BuildAnim(-1, 12, 0, x, y, z, nSector, 40, 0); + break; + default: + BuildAnim(-1, 39, 0, x, y, z, nSector, 40, 0); + if (pBullet->nType > 2) + { + BuildAnim(-1, pBulletInfo->field_C, 0, x, y, z, nSector, 40, pBulletInfo->nFlags); + } + break; } } diff --git a/source/exhumed/src/object.cpp b/source/exhumed/src/object.cpp index 038b56679..f54ce1d6e 100644 --- a/source/exhumed/src/object.cpp +++ b/source/exhumed/src/object.cpp @@ -1974,7 +1974,7 @@ void FuncObject(int a, int b, int nRun) return; } - if (sprite[nSprite].statnum != kStat98) { + if (sprite[nSprite].statnum != kStatAnubisDrum) { ObjectList[nObject].nHealth -= nDamage; } @@ -1984,7 +1984,7 @@ void FuncObject(int a, int b, int nRun) sprite[nSprite].yvel = 0; sprite[nSprite].zvel = 0; } - else if (sprite[nSprite].statnum != kStat98) + else if (sprite[nSprite].statnum != kStatAnubisDrum) { sprite[nSprite].xvel >>= 1; sprite[nSprite].yvel >>= 1; diff --git a/source/exhumed/src/object.h b/source/exhumed/src/object.h index 2ea1a3ecd..2738dc8a3 100644 --- a/source/exhumed/src/object.h +++ b/source/exhumed/src/object.h @@ -28,7 +28,7 @@ BEGIN_PS_NS enum kStatus { kStatDestructibleSprite = 97, - kStat98, + kStatAnubisDrum, kStatExplodeTrigger = 141, kStatExplodeTarget = 152 };