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"
|
2020-08-18 07:52:08 +00:00
|
|
|
#include "aistuff.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "sequence.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "exhumed.h"
|
|
|
|
#include <assert.h>
|
|
|
|
#include "engine.h"
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2020-10-11 09:33:28 +00:00
|
|
|
static actionSeq MummySeq[] = {
|
2019-08-31 07:47:15 +00:00
|
|
|
{8, 0},
|
|
|
|
{0, 0},
|
|
|
|
{16, 0},
|
|
|
|
{24, 0},
|
|
|
|
{32, 1},
|
|
|
|
{40, 1},
|
|
|
|
{48, 1},
|
|
|
|
{50, 0}
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
2019-12-26 21:00:04 +00:00
|
|
|
|
2021-11-23 00:18:20 +00:00
|
|
|
void BuildMummy(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle)
|
2020-11-29 19:34:55 +00:00
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
if (pActor == nullptr)
|
2020-11-29 19:34:55 +00:00
|
|
|
{
|
2021-11-23 00:18:20 +00:00
|
|
|
pActor = insertActor(pSector, 102);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
x = pActor->spr.pos.X;
|
|
|
|
y = pActor->spr.pos.Y;
|
|
|
|
z = pActor->spr.pos.Z;
|
|
|
|
nAngle = pActor->spr.ang;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
ChangeActorStat(pActor, 102);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.pos.X = x;
|
|
|
|
pActor->spr.pos.Y = y;
|
|
|
|
pActor->spr.pos.Z = z;
|
|
|
|
pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
|
|
|
pActor->spr.shade = -12;
|
|
|
|
pActor->spr.clipdist = 32;
|
|
|
|
pActor->spr.xvel = 0;
|
|
|
|
pActor->spr.yvel = 0;
|
|
|
|
pActor->spr.zvel = 0;
|
|
|
|
pActor->spr.xrepeat = 42;
|
|
|
|
pActor->spr.yrepeat = 42;
|
2021-12-30 15:51:56 +00:00
|
|
|
pActor->spr.pal = pActor->sector()->ceilingpal;
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xoffset = 0;
|
|
|
|
pActor->spr.yoffset = 0;
|
|
|
|
pActor->spr.ang = nAngle;
|
|
|
|
pActor->spr.picnum = 1;
|
|
|
|
pActor->spr.hitag = 0;
|
|
|
|
pActor->spr.lotag = runlist_HeadRun() + 1;
|
|
|
|
pActor->spr.extra = -1;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
// GrabTimeSlot(3);
|
|
|
|
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nAction = 0;
|
|
|
|
pActor->nHealth = 640;
|
|
|
|
pActor->nFrame = 0;
|
2021-10-17 23:05:38 +00:00
|
|
|
pActor->pTarget = nullptr;
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nCount = 0;
|
2021-10-17 23:05:38 +00:00
|
|
|
pActor->nPhase = Counters[kCountMummy]++;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.owner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0xE0000);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0xE0000);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-08-23 12:39:14 +00:00
|
|
|
nCreaturesTotal++;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
void CheckMummyRevive(DExhumedActor* pActor)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
ExhumedStatIterator it(102);
|
|
|
|
while (auto pOther = it.Next())
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
if (pOther != pActor)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
if (pOther->nAction != 5) {
|
2019-08-31 07:47:15 +00:00
|
|
|
continue;
|
|
|
|
}
|
2021-12-23 16:26:44 +00:00
|
|
|
int x = abs(pOther->spr.pos.X - pActor->spr.pos.X) >> 8;
|
|
|
|
int y = abs(pOther->spr.pos.Y - pActor->spr.pos.Y) >> 8;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
if (x <= 20 && y <= 20)
|
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
if (cansee(pActor->spr.pos.X, pActor->spr.pos.Y, pActor->spr.pos.Z - 8192, pActor->sector(),
|
|
|
|
pOther->spr.pos.X, pOther->spr.pos.Y, pOther->spr.pos.Z - 8192, pOther->sector()))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-12-23 16:26:44 +00:00
|
|
|
pOther->spr.cstat = 0;
|
2021-10-17 23:05:38 +00:00
|
|
|
pOther->nAction = 6;
|
|
|
|
pOther->nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
void AIMummy::Tick(RunListEvent* ev)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
auto pActor = ev->pObjActor;
|
|
|
|
if (!pActor) return;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-12-07 17:53:02 +00:00
|
|
|
DExhumedActor* targ = pActor->pTarget;
|
|
|
|
auto pTarget = UpdateEnemy(&targ);
|
|
|
|
pActor->pTarget = targ;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-11-21 19:34:15 +00:00
|
|
|
int nAction = pActor->nAction;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
Gravity(pActor);
|
2020-03-02 21:08:31 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
int nSeq = SeqOffsets[kSeqMummy] + MummySeq[nAction].a;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-11-21 19:34:15 +00:00
|
|
|
int nFrame = SeqBase[nSeq] + pActor->nFrame;
|
|
|
|
int nFrameFlag = FrameFlag[nFrame];
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
seq_MoveSequence(pActor, nSeq, pActor->nFrame);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
bool bVal = false;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nFrame++;
|
|
|
|
if (pActor->nFrame >= SeqSize[nSeq])
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
bVal = true;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
if (pTarget != nullptr && nAction < 4)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-12-21 22:18:23 +00:00
|
|
|
if ((!pTarget->spr.cstat) && nAction)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nAction = 0;
|
|
|
|
pActor->nFrame = 0;
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xvel = 0;
|
|
|
|
pActor->spr.yvel = 0;
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
auto nMov = MoveCreatureWithCaution(pActor);
|
2021-10-15 20:02:06 +00:00
|
|
|
|
|
|
|
if (nAction > 7)
|
|
|
|
return;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
switch (nAction)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
if ((pActor->nPhase & 0x1F) == (totalmoves & 0x1F))
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
2021-10-15 20:02:06 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
if (pTarget == nullptr)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-12-24 09:48:35 +00:00
|
|
|
pTarget = FindPlayer(pActor, 100);
|
2021-10-24 06:21:54 +00:00
|
|
|
if (pTarget != nullptr)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
D3PlayFX(StaticSound[kSound7], pActor);
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nFrame = 0;
|
2021-10-17 23:05:38 +00:00
|
|
|
pActor->pTarget = pTarget;
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nAction = 1;
|
|
|
|
pActor->nCount = 90;
|
2021-10-15 20:02:06 +00:00
|
|
|
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xvel = bcos(pActor->spr.ang, -2);
|
|
|
|
pActor->spr.yvel = bsin(pActor->spr.ang, -2);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
case 1:
|
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
if (pActor->nCount > 0)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nCount--;
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
if ((pActor->nPhase & 0x1F) == (totalmoves & 0x1F))
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
PlotCourseToSprite(pActor, pTarget);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-23 18:06:48 +00:00
|
|
|
if (pActor->nAction == 1)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
if (RandomBit() && pTarget)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
if (cansee(pActor->spr.pos.X, pActor->spr.pos.Y, pActor->spr.pos.Z - GetActorHeight(pActor), pActor->sector(),
|
|
|
|
pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.pos.Z - GetActorHeight(pTarget), pTarget->sector()))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nAction = 3;
|
|
|
|
pActor->nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xvel = 0;
|
|
|
|
pActor->spr.yvel = 0;
|
2021-10-15 20:02:06 +00:00
|
|
|
return;
|
2019-12-05 20:34:52 +00:00
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
// loc_2B5A8
|
2021-10-23 18:06:48 +00:00
|
|
|
if (!pActor->nFrame)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xvel = bcos(pActor->spr.ang, -1);
|
|
|
|
pActor->spr.yvel = bsin(pActor->spr.ang, -1);
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-12-23 16:04:37 +00:00
|
|
|
if (pActor->spr.xvel || pActor->spr.yvel)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
if (pActor->spr.xvel > 0)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xvel -= 1024;
|
|
|
|
if (pActor->spr.xvel < 0) {
|
|
|
|
pActor->spr.xvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
2021-12-23 16:04:37 +00:00
|
|
|
else if (pActor->spr.xvel < 0)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xvel += 1024;
|
|
|
|
if (pActor->spr.xvel > 0) {
|
|
|
|
pActor->spr.xvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-12-23 16:04:37 +00:00
|
|
|
if (pActor->spr.yvel > 0)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.yvel -= 1024;
|
|
|
|
if (pActor->spr.yvel < 0) {
|
|
|
|
pActor->spr.yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
2021-12-23 16:04:37 +00:00
|
|
|
else if (pActor->spr.yvel < 0)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.yvel += 1024;
|
|
|
|
if (pActor->spr.yvel > 0) {
|
|
|
|
pActor->spr.yvel = 0;
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
switch (nMov.type)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
case kHitWall:
|
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.ang = (pActor->spr.ang + ((RandomWord() & 0x3FF) + 1024)) & kAngleMask;
|
|
|
|
pActor->spr.xvel = bcos(pActor->spr.ang, -2);
|
|
|
|
pActor->spr.yvel = bsin(pActor->spr.ang, -2);
|
2021-10-17 23:05:38 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
case kHitSprite:
|
|
|
|
{
|
2021-11-26 13:26:03 +00:00
|
|
|
if (nMov.actor() == pTarget)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
int nAngle = getangle(pTarget->spr.pos.X - pActor->spr.pos.X, pTarget->spr.pos.Y - pActor->spr.pos.Y);
|
|
|
|
if (AngleDiff(pActor->spr.ang, nAngle) < 64)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
pActor->nAction = 2;
|
|
|
|
pActor->nFrame = 0;
|
2021-10-15 20:02:06 +00:00
|
|
|
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xvel = 0;
|
|
|
|
pActor->spr.yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
2021-10-17 23:05:38 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
case 2:
|
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
if (pTarget == nullptr)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nAction = 0;
|
|
|
|
pActor->nFrame = 0;
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
if (PlotCourseToSprite(pActor, pTarget) >= 1024)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nAction = 1;
|
|
|
|
pActor->nFrame = 0;
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
|
|
|
else if (nFrameFlag & 0x80)
|
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
runlist_DamageEnemy(pTarget, pActor, 5);
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2020-03-02 21:08:31 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
if (bVal)
|
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nFrame = 0;
|
|
|
|
pActor->nAction = 0;
|
|
|
|
pActor->nCount = 100;
|
2021-10-17 23:05:38 +00:00
|
|
|
pActor->pTarget = nullptr;
|
2021-10-15 20:02:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (nFrameFlag & 0x80)
|
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
SetQuake(pActor, 100);
|
2020-03-02 21:08:31 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
// low 16 bits of returned var contains the sprite index, the high 16 the bullet number
|
2021-12-23 16:04:37 +00:00
|
|
|
auto pBullet = BuildBullet(pActor, 9, -15360, pActor->spr.ang, pTarget, 1);
|
2021-10-17 23:05:38 +00:00
|
|
|
CheckMummyRevive(pActor);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
if (pBullet)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
|
|
|
if (!RandomSize(3))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-16 20:04:21 +00:00
|
|
|
SetBulletEnemy(pBullet->nPhase, pTarget);
|
2021-12-21 22:18:23 +00:00
|
|
|
pBullet->spr.pal = 5;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
case 4:
|
|
|
|
{
|
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nFrame = 0;
|
|
|
|
pActor->nAction = 5;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
case 5:
|
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nFrame = 0;
|
2021-10-15 20:02:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
{
|
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nAction = 0;
|
|
|
|
pActor->nHealth = 300;
|
2021-10-17 23:05:38 +00:00
|
|
|
pActor->pTarget = nullptr;
|
2021-10-15 20:02:06 +00:00
|
|
|
|
|
|
|
nCreaturesTotal++;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 7:
|
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
if (nMov.exbits)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xvel >>= 1;
|
|
|
|
pActor->spr.yvel >>= 1;
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
if (bVal)
|
|
|
|
{
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xvel = 0;
|
|
|
|
pActor->spr.yvel = 0;
|
|
|
|
pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nAction = 0;
|
|
|
|
pActor->nFrame = 0;
|
2021-10-17 23:05:38 +00:00
|
|
|
pActor->pTarget = nullptr;
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
void AIMummy::Draw(RunListEvent* ev)
|
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
auto pActor = ev->pObjActor;
|
|
|
|
if (!pActor) return;
|
2021-11-21 19:34:15 +00:00
|
|
|
int nAction = pActor->nAction;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-23 18:06:48 +00:00
|
|
|
seq_PlotSequence(ev->nParam, SeqOffsets[kSeqMummy] + MummySeq[nAction].a, pActor->nFrame, MummySeq[nAction].b);
|
2021-10-15 20:02:06 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 20:02:06 +00:00
|
|
|
void AIMummy::RadialDamage(RunListEvent* ev)
|
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
auto pActor = ev->pObjActor;
|
|
|
|
if (!pActor) return;
|
2019-12-05 20:34:52 +00:00
|
|
|
|
2021-10-23 18:06:48 +00:00
|
|
|
if (pActor->nHealth <= 0)
|
2021-10-15 20:02:06 +00:00
|
|
|
return;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
ev->nDamage = runlist_CheckRadialDamage(pActor);
|
2021-10-15 20:02:06 +00:00
|
|
|
Damage(ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AIMummy::Damage(RunListEvent* ev)
|
|
|
|
{
|
2021-10-17 23:05:38 +00:00
|
|
|
auto pActor = ev->pObjActor;
|
|
|
|
if (!pActor) return;
|
2021-10-15 20:02:06 +00:00
|
|
|
|
|
|
|
if (ev->nDamage <= 0)
|
|
|
|
return;
|
|
|
|
|
2021-10-23 18:06:48 +00:00
|
|
|
if (pActor->nHealth <= 0) {
|
2021-10-15 20:02:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nHealth -= dmgAdjust(ev->nDamage);
|
2021-10-15 20:02:06 +00:00
|
|
|
|
2021-10-23 18:06:48 +00:00
|
|
|
if (pActor->nHealth <= 0)
|
2021-10-15 20:02:06 +00:00
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nHealth = 0;
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
|
2021-10-15 20:02:06 +00:00
|
|
|
nCreaturesKilled++;
|
|
|
|
|
2021-10-17 23:05:38 +00:00
|
|
|
DropMagic(pActor);
|
2021-10-15 20:02:06 +00:00
|
|
|
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nFrame = 0;
|
|
|
|
pActor->nAction = 4;
|
2021-10-15 20:02:06 +00:00
|
|
|
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xvel = 0;
|
|
|
|
pActor->spr.yvel = 0;
|
|
|
|
pActor->spr.zvel = 0;
|
2021-12-30 15:51:56 +00:00
|
|
|
pActor->spr.pos.Z = pActor->sector()->floorz;
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!RandomSize(2))
|
|
|
|
{
|
2021-10-23 18:06:48 +00:00
|
|
|
pActor->nAction = 7;
|
|
|
|
pActor->nFrame = 0;
|
2021-10-15 20:02:06 +00:00
|
|
|
|
2021-12-23 16:04:37 +00:00
|
|
|
pActor->spr.xvel = 0;
|
|
|
|
pActor->spr.yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-10-15 20:02:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|