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)
{
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;

View file

@ -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 <string.h>
#include <assert.h>
#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,13 +264,12 @@ void BulletHitsSprite(Bullet *pBullet, short nBulletSprite, short nHitSprite, in
switch (nStat)
{
case 97:
case kStatDestructibleSprite:
break;
case 0:
case 98:
case kStatAnubisDrum:
case 102:
case 141:
case 152:
case kStatExplodeTrigger:
case kStatExplodeTarget:
BuildAnim(-1, 12, 0, x, y, z, nSector, 40, 0);
break;
default:

View file

@ -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;

View file

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