PCExhumed: Fix Anubis drum not moving correctly when shot (bad angle calc).

This commit is contained in:
sirlemonhead 2020-02-27 01:03:13 +00:00 committed by Christoph Oelckers
parent 314f8fee49
commit cd4090e531
4 changed files with 39 additions and 39 deletions

View file

@ -447,16 +447,16 @@ void FuncAnubis(int a, int nDamage, int nRun)
{ {
if (nAction >= 6 && nAction <= 10) 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[nDrumSprite].x = sprite[nSprite].x;
sprite[nThisSprite].y = sprite[nSprite].y; sprite[nDrumSprite].y = sprite[nSprite].y;
sprite[nThisSprite].z = sector[sprite[nThisSprite].sectnum].floorz; sprite[nDrumSprite].z = sector[sprite[nDrumSprite].sectnum].floorz;
sprite[nThisSprite].xrepeat = 40; sprite[nDrumSprite].xrepeat = 40;
sprite[nThisSprite].yrepeat = 40; sprite[nDrumSprite].yrepeat = 40;
sprite[nThisSprite].shade = -64; sprite[nDrumSprite].shade = -64;
BuildObject(nThisSprite, 2, 0); BuildObject(nDrumSprite, 2, 0);
} }
AnubisList[nAnubis].nAction = 4; AnubisList[nAnubis].nAction = 4;

View file

@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gun.h" #include "gun.h"
#include "names.h" #include "names.h"
#include "lighting.h" #include "lighting.h"
#include "object.h"
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#ifndef __WATCOMC__ #ifndef __WATCOMC__
@ -150,7 +151,7 @@ void IgniteSprite(int nSprite)
{ {
sprite[nSprite].hitag += 2; 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); short nAnimSprite = GetAnimSprite(nAnim);
sprite[nAnimSprite].hitag = nSprite; sprite[nAnimSprite].hitag = nSprite;
@ -175,7 +176,7 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in
{ {
case 3: case 3:
{ {
if (nStat > 107 || nStat == 98) { if (nStat > 107 || nStat == kStatAnubisDrum) {
return; return;
} }
@ -193,7 +194,7 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in
} }
case 14: case 14:
{ {
if (nStat > 107 || nStat == 98) { if (nStat > 107 || nStat == kStatAnubisDrum) {
return; return;
} }
// else - fall through to below cases // else - fall through to below cases
@ -217,7 +218,15 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
spritetype *pHitSprite = &sprite[nHitSprite]; 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 xVel = pHitSprite->xvel;
int yVel = pHitSprite->yvel; int yVel = pHitSprite->yvel;
@ -230,14 +239,6 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in
pHitSprite->xvel = xVel; pHitSprite->xvel = xVel;
pHitSprite->yvel = yVel; 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; break;
} }
@ -263,22 +264,21 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in
switch (nStat) switch (nStat)
{ {
case 97: case kStatDestructibleSprite:
break; break;
case 0: case kStatAnubisDrum:
case 98: case 102:
case 102: case kStatExplodeTrigger:
case 141: case kStatExplodeTarget:
case 152: BuildAnim(-1, 12, 0, x, y, z, nSector, 40, 0);
BuildAnim(-1, 12, 0, x, y, z, nSector, 40, 0); break;
break; default:
default: BuildAnim(-1, 39, 0, x, y, z, nSector, 40, 0);
BuildAnim(-1, 39, 0, x, y, z, nSector, 40, 0); if (pBullet->nType > 2)
if (pBullet->nType > 2) {
{ BuildAnim(-1, pBulletInfo->field_C, 0, x, y, z, nSector, 40, pBulletInfo->nFlags);
BuildAnim(-1, pBulletInfo->field_C, 0, x, y, z, nSector, 40, pBulletInfo->nFlags); }
} break;
break;
} }
} }

View file

@ -1974,7 +1974,7 @@ void FuncObject(int a, int b, int nRun)
return; return;
} }
if (sprite[nSprite].statnum != kStat98) { if (sprite[nSprite].statnum != kStatAnubisDrum) {
ObjectList[nObject].nHealth -= nDamage; ObjectList[nObject].nHealth -= nDamage;
} }
@ -1984,7 +1984,7 @@ void FuncObject(int a, int b, int nRun)
sprite[nSprite].yvel = 0; sprite[nSprite].yvel = 0;
sprite[nSprite].zvel = 0; sprite[nSprite].zvel = 0;
} }
else if (sprite[nSprite].statnum != kStat98) else if (sprite[nSprite].statnum != kStatAnubisDrum)
{ {
sprite[nSprite].xvel >>= 1; sprite[nSprite].xvel >>= 1;
sprite[nSprite].yvel >>= 1; sprite[nSprite].yvel >>= 1;

View file

@ -28,7 +28,7 @@ BEGIN_PS_NS
enum kStatus enum kStatus
{ {
kStatDestructibleSprite = 97, kStatDestructibleSprite = 97,
kStat98, kStatAnubisDrum,
kStatExplodeTrigger = 141, kStatExplodeTrigger = 141,
kStatExplodeTarget = 152 kStatExplodeTarget = 152
}; };