2019-11-20 16:21:32 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 sirlemonhead, Nuke.YKT
|
|
|
|
This file is part of PCExhumed.
|
|
|
|
PCExhumed is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-11-22 23:11:37 +00:00
|
|
|
#include "ns.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "exhumed.h"
|
2020-03-02 21:08:31 +00:00
|
|
|
#include "aistuff.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "engine.h"
|
|
|
|
#include "sequence.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include <assert.h>
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
struct Anubis
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nHealth;
|
|
|
|
short nFrame;
|
|
|
|
short nAction;
|
|
|
|
short nSprite;
|
|
|
|
short nTarget;
|
2020-11-29 19:16:58 +00:00
|
|
|
short nCount;
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
static TArray<Anubis> AnubisList;
|
|
|
|
static int nAnubisDrum = 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-10-11 09:33:28 +00:00
|
|
|
static actionSeq AnubisSeq[] = {
|
2019-08-31 07:47:15 +00:00
|
|
|
{ 0, 0 },
|
|
|
|
{ 8, 0 },
|
|
|
|
{ 16, 0 },
|
|
|
|
{ 24, 0 },
|
|
|
|
{ 32, 0 },
|
|
|
|
{ -1, 0 },
|
|
|
|
{ 46, 1 },
|
|
|
|
{ 46, 1 },
|
|
|
|
{ 47, 1 },
|
|
|
|
{ 49, 1 },
|
|
|
|
{ 49, 1 },
|
|
|
|
{ 40, 1 },
|
|
|
|
{ 42, 1 },
|
|
|
|
{ 41, 1 },
|
|
|
|
{ 43, 1 },
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
FSerializer& Serialize(FSerializer& arc, const char* keyname, Anubis& w, Anubis* def)
|
|
|
|
{
|
|
|
|
if (arc.BeginObject(keyname))
|
|
|
|
{
|
|
|
|
arc("health", w.nHealth)
|
|
|
|
("frame", w.nFrame)
|
|
|
|
("action", w.nAction)
|
|
|
|
("sprite", w.nSprite)
|
|
|
|
("target", w.nTarget)
|
2020-11-29 19:16:58 +00:00
|
|
|
("count", w.nCount)
|
2020-11-29 18:15:59 +00:00
|
|
|
.EndObject();
|
|
|
|
}
|
|
|
|
return arc;
|
|
|
|
}
|
2019-12-26 21:00:04 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
void SerializeAnubis(FSerializer& arc)
|
|
|
|
{
|
|
|
|
arc("anubis", AnubisList)
|
|
|
|
("anubisdrum", nAnubisDrum);
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
void InitAnubis()
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
AnubisList.Clear();
|
2019-08-31 07:47:15 +00:00
|
|
|
nAnubisDrum = 1;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
int BuildAnubis(int nSprite, int x, int y, int z, int nSector, int nAngle, uint8_t bIsDrummer)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
auto nAnubis = AnubisList.Reserve(1);
|
|
|
|
auto ap = &AnubisList[nAnubis];
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
spritetype* sp;
|
2019-08-31 07:47:15 +00:00
|
|
|
if (nSprite == -1)
|
|
|
|
{
|
|
|
|
nSprite = insertsprite(nSector, 101);
|
2020-11-29 18:15:59 +00:00
|
|
|
sp = &sprite[nSprite];
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
changespritestat(nSprite, 101);
|
2020-11-29 18:15:59 +00:00
|
|
|
sp = &sprite[nSprite];
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
x = sp->x;
|
|
|
|
y = sp->y;
|
|
|
|
z = sector[sp->sectnum].floorz;
|
|
|
|
nAngle = sp->ang;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
assert(nSprite >=0 && nSprite < kMaxSprites);
|
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->x = x;
|
|
|
|
sp->y = y;
|
|
|
|
sp->z = z;
|
|
|
|
sp->cstat = 0x101;
|
|
|
|
sp->xoffset = 0;
|
|
|
|
sp->shade = -12;
|
|
|
|
sp->yoffset = 0;
|
|
|
|
sp->picnum = 1;
|
|
|
|
sp->pal = sector[sp->sectnum].ceilingpal;
|
|
|
|
sp->clipdist = 60;
|
|
|
|
sp->ang = nAngle;
|
|
|
|
sp->xrepeat = 40;
|
|
|
|
sp->yrepeat = 40;
|
|
|
|
sp->xvel = 0;
|
|
|
|
sp->yvel = 0;
|
|
|
|
sp->zvel = 0;
|
|
|
|
sp->hitag = 0;
|
|
|
|
sp->lotag = runlist_HeadRun() + 1;
|
|
|
|
sp->extra = -1;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
// GrabTimeSlot(3);
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
if (bIsDrummer)
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = nAnubisDrum + 6;
|
2019-08-31 07:47:15 +00:00
|
|
|
nAnubisDrum++;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
if (nAnubisDrum >= 5) {
|
|
|
|
nAnubisDrum = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nHealth = 540;
|
|
|
|
ap->nFrame = 0;
|
|
|
|
ap->nSprite = nSprite;
|
|
|
|
ap->nTarget = -1;
|
2020-11-29 19:16:58 +00:00
|
|
|
ap->nCount = 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->owner = runlist_AddRunRec(sp->lotag - 1, nAnubis | 0x90000);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
runlist_AddRunRec(NewRun, nAnubis | 0x90000);
|
2020-08-23 12:39:14 +00:00
|
|
|
nCreaturesTotal++;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
return nAnubis | 0x90000;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FuncAnubis(int a, int nDamage, int nRun)
|
|
|
|
{
|
2020-11-29 18:31:49 +00:00
|
|
|
int nAnubis = RunData[nRun].nVal;
|
2020-11-29 18:15:59 +00:00
|
|
|
auto ap = &AnubisList[nAnubis];
|
|
|
|
assert(nAnubis >= 0 && nAnubis < (int)AnubisList.Size());
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 18:31:49 +00:00
|
|
|
int nSprite = ap->nSprite;
|
2020-11-29 18:15:59 +00:00
|
|
|
auto sp = &sprite[nSprite];
|
|
|
|
short nAction = ap->nAction;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-03-02 21:08:31 +00:00
|
|
|
bool bVal = false;
|
|
|
|
|
|
|
|
int nMessage = a & kMessageMask;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
switch (nMessage)
|
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
default:
|
|
|
|
{
|
|
|
|
DebugOut("unknown msg %d for Anubis\n", nMessage);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
case 0x20000:
|
|
|
|
{
|
|
|
|
if (nAction < 11) {
|
|
|
|
Gravity(nSprite);
|
|
|
|
}
|
|
|
|
|
2020-10-11 09:33:28 +00:00
|
|
|
short nSeq = SeqOffsets[kSeqAnubis] + AnubisSeq[nAction].a;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
seq_MoveSequence(nSprite, nSeq, ap->nFrame);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->picnum = seq_GetSeqPicnum2(nSeq, ap->nFrame);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nFrame++;
|
|
|
|
if (ap->nFrame >= SeqSize[nSeq])
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nFrame = 0;
|
2020-03-02 21:08:31 +00:00
|
|
|
bVal = true;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
short nTarget = ap->nTarget;
|
2021-09-06 06:33:02 +00:00
|
|
|
auto pTarget = nTarget < 0? nullptr : &sprite[nTarget];
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
short nFrame = SeqBase[nSeq] + ap->nFrame;
|
2019-08-31 07:47:15 +00:00
|
|
|
short nFlag = FrameFlag[nFrame];
|
|
|
|
|
2020-03-02 21:08:31 +00:00
|
|
|
int nMov = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
if (nAction > 0 && nAction < 11) {
|
2020-03-02 21:08:31 +00:00
|
|
|
nMov = MoveCreatureWithCaution(nSprite);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (nAction)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
if ((nAnubis & 0x1F) == (totalmoves & 0x1F))
|
|
|
|
{
|
|
|
|
if (nTarget < 0) {
|
|
|
|
nTarget = FindPlayer(nSprite, 100);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nTarget >= 0)
|
|
|
|
{
|
|
|
|
D3PlayFX(StaticSound[kSound8], nSprite);
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = 1;
|
|
|
|
ap->nFrame = 0;
|
|
|
|
ap->nTarget = nTarget;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->xvel = bcos(sp->ang, -2);
|
|
|
|
sp->yvel = bsin(sp->ang, -2);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
if ((nAnubis & 0x1F) == (totalmoves & 0x1F))
|
|
|
|
{
|
|
|
|
PlotCourseToSprite(nSprite, nTarget);
|
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
int nAngle = sp->ang & 0xFFF8;
|
|
|
|
sp->xvel = bcos(nAngle, -2);
|
|
|
|
sp->yvel = bsin(nAngle, -2);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 21:08:31 +00:00
|
|
|
switch (nMov & 0xC000)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
case 0xC000:
|
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
if ((nMov & 0x3FFF) == nTarget)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
int nAng = getangle(pTarget->x - sp->x, pTarget->y - sp->y);
|
2020-11-29 18:15:59 +00:00
|
|
|
int nAngDiff = AngleDiff(sp->ang, nAng);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
if (nAngDiff < 64)
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = 2;
|
|
|
|
ap->nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2020-03-02 21:08:31 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
// else we fall through to 0x8000
|
2019-12-02 14:56:24 +00:00
|
|
|
fallthrough__;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
case 0x8000:
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->ang = (sp->ang + 256) & kAngleMask;
|
|
|
|
sp->xvel = bcos(sp->ang, -2);
|
|
|
|
sp->yvel = bsin(sp->ang, -2);
|
2019-08-31 07:47:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
2020-11-29 19:16:58 +00:00
|
|
|
if (ap->nCount)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 19:16:58 +00:00
|
|
|
ap->nCount--;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-29 19:16:58 +00:00
|
|
|
ap->nCount = 60;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-03-12 21:57:23 +00:00
|
|
|
if (nTarget > -1) // NOTE: nTarget can be -1. this check wasn't in original code. TODO: demo compatiblity?
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
if (cansee(sp->x, sp->y, sp->z - GetSpriteHeight(nSprite), sp->sectnum,
|
2021-09-06 06:33:02 +00:00
|
|
|
pTarget->x, pTarget->y, pTarget->z - GetSpriteHeight(nTarget), pTarget->sectnum))
|
2020-03-12 21:57:23 +00:00
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->xvel = 0;
|
|
|
|
sp->yvel = 0;
|
2021-09-06 06:33:02 +00:00
|
|
|
sp->ang = GetMyAngle(pTarget->x - sp->x, pTarget->y - sp->y);
|
2020-03-12 21:57:23 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = 3;
|
|
|
|
ap->nFrame = 0;
|
2020-03-12 21:57:23 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
if (nTarget == -1)
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = 0;
|
2020-11-29 19:16:58 +00:00
|
|
|
ap->nCount = 50;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (PlotCourseToSprite(nSprite, nTarget) >= 768)
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = 1;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (nFlag & 0x80)
|
|
|
|
{
|
|
|
|
runlist_DamageEnemy(nTarget, nSprite, 7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = 1;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->xvel = bcos(sp->ang, -2);
|
|
|
|
sp->yvel = bsin(sp->ang, -2);
|
|
|
|
ap->nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// loc_25718:
|
|
|
|
if (nFlag & 0x80)
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
BuildBullet(nSprite, 8, 0, 0, -1, sp->ang, nTarget + 10000, 1);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->xvel = 0;
|
|
|
|
sp->yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-03-02 21:08:31 +00:00
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = 1;
|
|
|
|
ap->nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
case 10:
|
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = (RandomSize(3) % 5) + 6;
|
|
|
|
ap->nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 11:
|
|
|
|
case 12:
|
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = nAction + 2;
|
|
|
|
ap->nFrame = 0;
|
2019-12-05 19:46:59 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->xvel = 0;
|
|
|
|
sp->yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 13:
|
|
|
|
case 14:
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->cstat &= 0xFEFE;
|
2019-08-31 07:47:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
// loc_2564C:
|
|
|
|
if (nAction && nTarget != -1)
|
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
if (!(pTarget->cstat & 0x101))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = 0;
|
|
|
|
ap->nFrame = 0;
|
2020-11-29 19:16:58 +00:00
|
|
|
ap->nCount = 100;
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nTarget = -1;
|
2019-12-05 19:46:59 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->xvel = 0;
|
|
|
|
sp->yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0x90000:
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
seq_PlotSequence(a & 0xFFFF, SeqOffsets[kSeqAnubis] + AnubisSeq[nAction].a, ap->nFrame, AnubisSeq[nAction].b);
|
2019-08-31 07:47:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0xA0000: // fall through to next case
|
|
|
|
{
|
|
|
|
if (nAction >= 11) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nDamage = runlist_CheckRadialDamage(nSprite);
|
2019-12-02 14:56:24 +00:00
|
|
|
fallthrough__;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
case 0x80000:
|
|
|
|
{
|
|
|
|
if (nDamage)
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
if (ap->nHealth <= 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
return;
|
|
|
|
|
2021-02-27 13:05:55 +00:00
|
|
|
ap->nHealth -= dmgAdjust(nDamage);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
if (ap->nHealth > 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
short nTarget = a & 0xFFFF;
|
|
|
|
|
|
|
|
// loc_258D6:
|
|
|
|
if (nTarget < 0) {
|
|
|
|
return;
|
|
|
|
}
|
2021-09-06 06:33:02 +00:00
|
|
|
auto pTarget = &sprite[nTarget];
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
if (pTarget->statnum == 100 || pTarget->statnum < 199)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
if (!RandomSize(5)) {
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nTarget = nTarget;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RandomSize(1))
|
|
|
|
{
|
|
|
|
if (nAction >= 6 && nAction <= 10)
|
|
|
|
{
|
2020-11-29 18:15:59 +00:00
|
|
|
int nDrumSprite = insertsprite(sp->sectnum, kStatAnubisDrum);
|
2021-09-06 06:33:02 +00:00
|
|
|
auto pDrumSprite = &sprite[nDrumSprite];
|
|
|
|
|
|
|
|
pDrumSprite->x = sp->x;
|
|
|
|
pDrumSprite->y = sp->y;
|
|
|
|
pDrumSprite->z = sector[pDrumSprite->sectnum].floorz;
|
|
|
|
pDrumSprite->xrepeat = 40;
|
|
|
|
pDrumSprite->yrepeat = 40;
|
|
|
|
pDrumSprite->shade = -64;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-02-27 01:03:13 +00:00
|
|
|
BuildObject(nDrumSprite, 2, 0);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = 4;
|
|
|
|
ap->nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// loc_259B5:
|
|
|
|
D3PlayFX(StaticSound[kSound39], nSprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// he ded.
|
2020-11-29 18:15:59 +00:00
|
|
|
sp->xvel = 0;
|
|
|
|
sp->yvel = 0;
|
|
|
|
sp->zvel = 0;
|
|
|
|
sp->z = sector[sp->sectnum].floorz;
|
|
|
|
sp->cstat &= 0xFEFE;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nHealth = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-08-23 12:39:14 +00:00
|
|
|
nCreaturesKilled++;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
if (nAction < 11)
|
|
|
|
{
|
|
|
|
DropMagic(nSprite);
|
2020-11-29 18:15:59 +00:00
|
|
|
ap->nAction = (nMessage == 0xA0000) + 11;
|
|
|
|
ap->nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|