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
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
struct Mummy
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nHealth;
|
2020-11-29 19:34:55 +00:00
|
|
|
short nFrame;
|
2019-08-31 07:47:15 +00:00
|
|
|
short nAction;
|
|
|
|
short nSprite;
|
|
|
|
short nTarget;
|
2020-11-29 19:34:55 +00:00
|
|
|
short nIndex;
|
|
|
|
short nCount;
|
|
|
|
short nRun;
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
2020-11-29 19:34:55 +00:00
|
|
|
TArray<Mummy> MummyList;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
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
|
|
|
|
2020-11-29 19:34:55 +00:00
|
|
|
FSerializer& Serialize(FSerializer& arc, const char* keyname, Mummy& w, Mummy* def)
|
|
|
|
{
|
|
|
|
if (arc.BeginObject(keyname))
|
|
|
|
{
|
|
|
|
arc("health", w.nHealth)
|
|
|
|
("frame", w.nFrame)
|
|
|
|
("action", w.nAction)
|
|
|
|
("sprite", w.nSprite)
|
|
|
|
("target", w.nTarget)
|
|
|
|
("index", w.nIndex)
|
|
|
|
("count", w.nCount)
|
|
|
|
("run", w.nRun)
|
|
|
|
.EndObject();
|
|
|
|
}
|
|
|
|
return arc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SerializeMummy(FSerializer& arc)
|
|
|
|
{
|
|
|
|
arc("mummy", MummyList);
|
|
|
|
}
|
2019-12-26 21:00:04 +00:00
|
|
|
|
2020-02-04 21:45:10 +00:00
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
void InitMummy()
|
|
|
|
{
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList.Clear();
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int BuildMummy(int nSprite, int x, int y, int z, int nSector, int nAngle)
|
|
|
|
{
|
2020-11-29 19:34:55 +00:00
|
|
|
auto nMummy = MummyList.Reserve(1);
|
2021-09-06 06:33:02 +00:00
|
|
|
auto pSprite = &sprite[nSprite];
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
if (nSprite == -1)
|
|
|
|
{
|
|
|
|
nSprite = insertsprite(nSector, 102);
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite = &sprite[nSprite];
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
x = pSprite->x;
|
|
|
|
y = pSprite->y;
|
|
|
|
z = pSprite->z;
|
|
|
|
nAngle = pSprite->ang;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
changespritestat(nSprite, 102);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(nSprite >= 0 && nSprite < kMaxSprites);
|
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->x = x;
|
|
|
|
pSprite->y = y;
|
|
|
|
pSprite->z = z;
|
|
|
|
pSprite->cstat = 0x101;
|
|
|
|
pSprite->shade = -12;
|
|
|
|
pSprite->clipdist = 32;
|
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 0;
|
|
|
|
pSprite->zvel = 0;
|
|
|
|
pSprite->xrepeat = 42;
|
|
|
|
pSprite->yrepeat = 42;
|
|
|
|
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
|
|
|
|
pSprite->xoffset = 0;
|
|
|
|
pSprite->yoffset = 0;
|
|
|
|
pSprite->ang = nAngle;
|
|
|
|
pSprite->picnum = 1;
|
|
|
|
pSprite->hitag = 0;
|
|
|
|
pSprite->lotag = runlist_HeadRun() + 1;
|
|
|
|
pSprite->extra = -1;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
// GrabTimeSlot(3);
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
MummyList[nMummy].nAction = 0;
|
|
|
|
MummyList[nMummy].nHealth = 640;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
MummyList[nMummy].nSprite = nSprite;
|
|
|
|
MummyList[nMummy].nTarget = -1;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nIndex = nMummy;
|
|
|
|
MummyList[nMummy].nCount = 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->owner = runlist_AddRunRec(pSprite->lotag - 1, nMummy | 0xE0000);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nRun = runlist_AddRunRec(NewRun, nMummy | 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
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
return (nMummy | 0xE0000);
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CheckMummyRevive(short nMummy)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nSprite = MummyList[nMummy].nSprite;
|
2021-09-06 06:33:02 +00:00
|
|
|
auto pSprite = &sprite[nSprite];
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 19:34:55 +00:00
|
|
|
for (unsigned i = 0; i < MummyList.Size(); i++)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-08 17:22:21 +00:00
|
|
|
if ((int)i != nMummy)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
short nSprite2 = MummyList[i].nSprite;
|
|
|
|
if (sprite[nSprite2].statnum != 102) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (MummyList[i].nAction != 5) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
int x = abs(sprite[nSprite2].x - pSprite->x) >> 8;
|
|
|
|
int y = abs(sprite[nSprite2].y - pSprite->y) >> 8;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
if (x <= 20 && y <= 20)
|
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
if (cansee(pSprite->x, pSprite->y, pSprite->z - 8192, pSprite->sectnum,
|
2019-12-05 20:34:52 +00:00
|
|
|
sprite[nSprite2].x, sprite[nSprite2].y, sprite[nSprite2].z - 8192, sprite[nSprite2].sectnum))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
sprite[nSprite2].cstat = 0;
|
|
|
|
MummyList[i].nAction = 6;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[i].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FuncMummy(int a, int nDamage, int nRun)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nMummy = RunData[nRun].nVal;
|
|
|
|
assert(nMummy >= 0 && nMummy < kMaxMummies);
|
|
|
|
|
|
|
|
short nTarget = UpdateEnemy(&MummyList[nMummy].nTarget);
|
|
|
|
|
|
|
|
short nSprite = MummyList[nMummy].nSprite;
|
2021-09-06 06:33:02 +00:00
|
|
|
auto pSprite = &sprite[nSprite];
|
2019-08-31 07:47:15 +00:00
|
|
|
short nAction = MummyList[nMummy].nAction;
|
|
|
|
|
2020-02-04 21:45:10 +00:00
|
|
|
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 Mummy\n", nMessage);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
case 0x20000:
|
|
|
|
{
|
|
|
|
Gravity(nSprite);
|
|
|
|
|
2020-10-11 09:33:28 +00:00
|
|
|
int nSeq = SeqOffsets[kSeqMummy] + MummySeq[nAction].a;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->picnum = seq_GetSeqPicnum2(nSeq, MummyList[nMummy].nFrame);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 19:34:55 +00:00
|
|
|
short nFrame = SeqBase[nSeq] + MummyList[nMummy].nFrame;
|
2019-08-31 07:47:15 +00:00
|
|
|
short nFrameFlag = FrameFlag[nFrame];
|
|
|
|
|
2020-11-29 19:34:55 +00:00
|
|
|
seq_MoveSequence(nSprite, nSeq, MummyList[nMummy].nFrame);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-03-02 21:08:31 +00:00
|
|
|
bool bVal = false;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame++;
|
|
|
|
if (MummyList[nMummy].nFrame >= SeqSize[nSeq])
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-02-04 21:45:10 +00:00
|
|
|
bVal = true;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (nTarget != -1 && nAction < 4)
|
|
|
|
{
|
2019-12-05 20:34:52 +00:00
|
|
|
if ((!sprite[nTarget].cstat) && nAction)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
MummyList[nMummy].nAction = 0;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int nMov = MoveCreatureWithCaution(nSprite);
|
|
|
|
|
|
|
|
if (nAction > 7)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (nAction)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
2020-11-29 19:34:55 +00:00
|
|
|
if ((MummyList[nMummy].nIndex & 0x1F) == (totalmoves & 0x1F))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->cstat = 0x101;
|
2019-12-05 20:34:52 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
if (nTarget < 0)
|
|
|
|
{
|
2019-12-05 20:34:52 +00:00
|
|
|
int nTarget = FindPlayer(nSprite, 100);
|
|
|
|
if (nTarget >= 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
D3PlayFX(StaticSound[kSound7], nSprite);
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-12-05 20:34:52 +00:00
|
|
|
MummyList[nMummy].nTarget = nTarget;
|
2019-08-31 07:47:15 +00:00
|
|
|
MummyList[nMummy].nAction = 1;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nCount = 90;
|
2019-12-05 20:34:52 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = bcos(pSprite->ang, -2);
|
|
|
|
pSprite->yvel = bsin(pSprite->ang, -2);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
{
|
2020-11-29 19:34:55 +00:00
|
|
|
if (MummyList[nMummy].nCount > 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nCount--;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2020-11-29 19:34:55 +00:00
|
|
|
if ((MummyList[nMummy].nIndex & 0x1F) == (totalmoves & 0x1F))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->cstat = 0x101;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
PlotCourseToSprite(nSprite, nTarget);
|
|
|
|
|
|
|
|
if (MummyList[nMummy].nAction == 1)
|
|
|
|
{
|
|
|
|
if (RandomBit())
|
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
if (cansee(pSprite->x, pSprite->y, pSprite->z - GetSpriteHeight(nSprite), pSprite->sectnum,
|
2019-12-05 20:34:52 +00:00
|
|
|
sprite[nTarget].x, sprite[nTarget].y, sprite[nTarget].z - GetSpriteHeight(nTarget), sprite[nTarget].sectnum))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
MummyList[nMummy].nAction = 3;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-12-05 20:34:52 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-05 20:34:52 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-12-05 20:34:52 +00:00
|
|
|
// loc_2B5A8
|
2020-11-29 19:34:55 +00:00
|
|
|
if (!MummyList[nMummy].nFrame)
|
2019-12-05 20:34:52 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = bcos(pSprite->ang, -1);
|
|
|
|
pSprite->yvel = bsin(pSprite->ang, -1);
|
2019-12-05 20:34:52 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
if (pSprite->xvel || pSprite->yvel)
|
2019-12-05 20:34:52 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
if (pSprite->xvel > 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel -= 1024;
|
|
|
|
if (pSprite->xvel < 0) {
|
|
|
|
pSprite->xvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-12-05 20:34:52 +00:00
|
|
|
}
|
2021-09-06 06:33:02 +00:00
|
|
|
else if (pSprite->xvel < 0)
|
2019-12-05 20:34:52 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel += 1024;
|
|
|
|
if (pSprite->xvel > 0) {
|
|
|
|
pSprite->xvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-12-05 20:34:52 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
if (pSprite->yvel > 0)
|
2019-12-05 20:34:52 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->yvel -= 1024;
|
|
|
|
if (pSprite->yvel < 0) {
|
|
|
|
pSprite->yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-12-05 20:34:52 +00:00
|
|
|
}
|
2021-09-06 06:33:02 +00:00
|
|
|
else if (pSprite->yvel < 0)
|
2019-12-05 20:34:52 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->yvel += 1024;
|
|
|
|
if (pSprite->yvel > 0) {
|
|
|
|
pSprite->yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2019-12-05 20:34:52 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-12-05 20:34:52 +00:00
|
|
|
if (nMov)
|
|
|
|
{
|
|
|
|
switch (nMov & 0xC000)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-12-05 20:34:52 +00:00
|
|
|
case 0x8000:
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->ang = (pSprite->ang + ((RandomWord() & 0x3FF) + 1024)) & kAngleMask;
|
|
|
|
pSprite->xvel = bcos(pSprite->ang, -2);
|
|
|
|
pSprite->yvel = bsin(pSprite->ang, -2);
|
2019-12-05 20:34:52 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-12-05 20:34:52 +00:00
|
|
|
case 0xC000:
|
|
|
|
{
|
|
|
|
if ((nMov & 0x3FFF) == nTarget)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
int nAngle = getangle(sprite[nTarget].x - pSprite->x, sprite[nTarget].y - pSprite->y);
|
|
|
|
if (AngleDiff(pSprite->ang, nAngle) < 64)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-12-05 20:34:52 +00:00
|
|
|
MummyList[nMummy].nAction = 2;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-12-05 20:34:52 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2019-12-05 20:34:52 +00:00
|
|
|
return;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
if (nTarget == -1)
|
|
|
|
{
|
|
|
|
MummyList[nMummy].nAction = 0;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (PlotCourseToSprite(nSprite, nTarget) >= 1024)
|
|
|
|
{
|
|
|
|
MummyList[nMummy].nAction = 1;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else if (nFrameFlag & 0x80)
|
|
|
|
{
|
|
|
|
runlist_DamageEnemy(nTarget, nSprite, 5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
{
|
2020-02-04 21:45:10 +00:00
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
MummyList[nMummy].nAction = 0;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nCount = 100;
|
2019-08-31 07:47:15 +00:00
|
|
|
MummyList[nMummy].nTarget = -1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (nFrameFlag & 0x80)
|
|
|
|
{
|
|
|
|
SetQuake(nSprite, 100);
|
|
|
|
|
|
|
|
// low 16 bits of returned var contains the sprite index, the high 16 the bullet number
|
2021-09-06 06:33:02 +00:00
|
|
|
int nBullet = BuildBullet(nSprite, 9, 0, 0, -15360, pSprite->ang, nTarget + 10000, 1);
|
2019-08-31 07:47:15 +00:00
|
|
|
CheckMummyRevive(nMummy);
|
|
|
|
|
|
|
|
if (nBullet > -1)
|
|
|
|
{
|
|
|
|
if (!RandomSize(3))
|
|
|
|
{
|
|
|
|
// FIXME CHECKME - nBullet & 0xFFFF can be -1. Original code doesn't handle this??
|
|
|
|
|
2020-09-01 13:00:35 +00:00
|
|
|
SetBulletEnemy(FixedToInt(nBullet), nTarget); // isolate the bullet number (shift off the sprite index)
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nBullet & 0xFFFF].pal = 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
{
|
2020-02-04 21:45:10 +00:00
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
MummyList[nMummy].nAction = 5;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
{
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
{
|
2020-02-04 21:45:10 +00:00
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->cstat = 0x101;
|
2020-03-02 21:08:31 +00:00
|
|
|
|
|
|
|
MummyList[nMummy].nAction = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
MummyList[nMummy].nHealth = 300;
|
|
|
|
MummyList[nMummy].nTarget = -1;
|
2020-03-02 21:08:31 +00:00
|
|
|
|
2020-08-23 12:39:14 +00:00
|
|
|
nCreaturesTotal++;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 7:
|
|
|
|
{
|
|
|
|
if (nMov & 0x20000)
|
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel >>= 1;
|
|
|
|
pSprite->yvel >>= 1;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2020-02-04 21:45:10 +00:00
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 0;
|
|
|
|
pSprite->cstat = 0x101;
|
2019-12-05 20:34:52 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
MummyList[nMummy].nAction = 0;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
MummyList[nMummy].nTarget = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0x90000:
|
|
|
|
{
|
2020-11-29 19:34:55 +00:00
|
|
|
seq_PlotSequence(a & 0xFFFF, SeqOffsets[kSeqMummy] + MummySeq[nAction].a, MummyList[nMummy].nFrame, MummySeq[nAction].b);
|
2019-08-31 07:47:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0xA0000:
|
|
|
|
{
|
|
|
|
if (MummyList[nMummy].nHealth <= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
nDamage = runlist_CheckRadialDamage(nSprite);
|
|
|
|
// fall through to 0x80000
|
2019-12-02 14:56:24 +00:00
|
|
|
fallthrough__;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
case 0x80000:
|
|
|
|
{
|
|
|
|
if (nDamage <= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (MummyList[nMummy].nHealth <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2021-02-27 13:05:55 +00:00
|
|
|
MummyList[nMummy].nHealth -= dmgAdjust(nDamage);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
if (MummyList[nMummy].nHealth <= 0)
|
|
|
|
{
|
|
|
|
MummyList[nMummy].nHealth = 0;
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->cstat &= 0xFEFE;
|
2020-08-23 12:39:14 +00:00
|
|
|
nCreaturesKilled++;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
DropMagic(nSprite);
|
|
|
|
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
MummyList[nMummy].nAction = 4;
|
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 0;
|
|
|
|
pSprite->zvel = 0;
|
|
|
|
pSprite->z = sector[pSprite->sectnum].floorz;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!RandomSize(2))
|
|
|
|
{
|
|
|
|
MummyList[nMummy].nAction = 7;
|
2020-11-29 19:34:55 +00:00
|
|
|
MummyList[nMummy].nFrame = 0;
|
2019-12-05 20:34:52 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 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
|