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 "exhumed.h"
|
|
|
|
#include "engine.h"
|
|
|
|
#include "sequence.h"
|
|
|
|
#include <assert.h>
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2020-10-11 09:33:28 +00:00
|
|
|
static actionSeq RoachSeq[] = {
|
2020-03-02 21:08:31 +00:00
|
|
|
{24, 0},
|
|
|
|
{0, 0},
|
|
|
|
{0, 0},
|
|
|
|
{16, 0},
|
|
|
|
{8, 0},
|
|
|
|
{32, 1},
|
|
|
|
{42, 1}
|
|
|
|
};
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
struct Roach
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nHealth;
|
2020-11-29 19:47:55 +00:00
|
|
|
short nFrame;
|
2019-11-15 20:42:46 +00:00
|
|
|
short nAction;
|
2019-08-31 07:47:15 +00:00
|
|
|
short nSprite;
|
|
|
|
short nTarget;
|
2020-11-29 19:47:55 +00:00
|
|
|
short nRun;
|
|
|
|
short nCount;
|
|
|
|
short nIndex;
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
2020-11-29 19:47:55 +00:00
|
|
|
TArray<Roach> RoachList;
|
|
|
|
|
|
|
|
FSerializer& Serialize(FSerializer& arc, const char* keyname, Roach& w, Roach* def)
|
|
|
|
{
|
|
|
|
if (arc.BeginObject(keyname))
|
|
|
|
{
|
|
|
|
arc("health", w.nHealth)
|
|
|
|
("frame", w.nFrame)
|
|
|
|
("action", w.nAction)
|
|
|
|
("sprite", w.nSprite)
|
|
|
|
("target", w.nTarget)
|
|
|
|
("run", w.nRun)
|
|
|
|
("count", w.nCount)
|
|
|
|
("index", w.nIndex)
|
|
|
|
.EndObject();
|
|
|
|
}
|
|
|
|
return arc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SerializeRoach(FSerializer& arc)
|
|
|
|
{
|
|
|
|
arc("roach", RoachList);
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-12-26 21:00:04 +00:00
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
/* Kilmaat Sentry */
|
|
|
|
|
|
|
|
void InitRoachs()
|
|
|
|
{
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList.Clear();
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2019-11-15 20:42:46 +00:00
|
|
|
// TODO - make nType a bool?
|
|
|
|
int BuildRoach(int nType, int nSprite, int x, int y, int z, short nSector, int angle)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2020-11-29 19:47:55 +00:00
|
|
|
auto RoachCount = RoachList.Reserve(1);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
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, 105);
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite = &sprite[nSprite];
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
changespritestat(nSprite, 105);
|
2021-09-06 06:33:02 +00:00
|
|
|
x = pSprite->x;
|
|
|
|
y = pSprite->y;
|
|
|
|
z = sector[pSprite->sectnum].floorz;
|
|
|
|
angle = pSprite->ang;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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->xoffset = 0;
|
|
|
|
pSprite->yoffset = 0;
|
|
|
|
pSprite->picnum = 1;
|
|
|
|
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
|
|
|
|
pSprite->clipdist = 60;
|
|
|
|
pSprite->ang = angle;
|
|
|
|
pSprite->xrepeat = 40;
|
|
|
|
pSprite->yrepeat = 40;
|
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 0;
|
|
|
|
pSprite->zvel = 0;
|
|
|
|
pSprite->hitag = 0;
|
|
|
|
pSprite->lotag = runlist_HeadRun() + 1;
|
|
|
|
pSprite->extra = -1;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-13 16:50:52 +00:00
|
|
|
// GrabTimeSlot(3);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-15 20:42:46 +00:00
|
|
|
if (nType)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[RoachCount].nAction = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[RoachCount].nAction = 1;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
RoachList[RoachCount].nSprite = nSprite;
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[RoachCount].nFrame = 0;
|
|
|
|
RoachList[RoachCount].nCount = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
RoachList[RoachCount].nTarget = -1;
|
|
|
|
RoachList[RoachCount].nHealth = 600;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->owner = runlist_AddRunRec(pSprite->lotag - 1, RoachCount | 0x1C0000);
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[RoachCount].nRun = runlist_AddRunRec(NewRun, RoachCount | 0x1C0000);
|
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 RoachCount | 0x1C0000;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GoRoach(short nSprite)
|
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
auto pSprite = &sprite[nSprite];
|
|
|
|
pSprite->xvel = bcos(pSprite->ang, -1) - bcos(pSprite->ang, -3);
|
|
|
|
pSprite->yvel = bsin(pSprite->ang, -1) - bsin(pSprite->ang, -3);
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2019-11-13 16:50:52 +00:00
|
|
|
void FuncRoach(int a, int nDamage, int nRun)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nRoach = RunData[nRun].nVal;
|
2020-11-29 19:47:55 +00:00
|
|
|
assert(nRoach >= 0 && nRoach < (int)RoachList.Size());
|
2020-03-02 21:08:31 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
short nSprite = RoachList[nRoach].nSprite;
|
2021-09-06 06:33:02 +00:00
|
|
|
auto pSprite = &sprite[nSprite];
|
2019-11-15 20:42:46 +00:00
|
|
|
short nAction = RoachList[nRoach].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)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
Printf("unknown msg %d for Roach\n", nMessage);
|
2019-08-31 07:47:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0x90000:
|
|
|
|
{
|
2020-11-29 19:47:55 +00:00
|
|
|
seq_PlotSequence(a & 0xFFFF, RoachSeq[nAction].a + SeqOffsets[kSeqRoach], RoachList[nRoach].nFrame, RoachSeq[nAction].b);
|
2019-08-31 07:47:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-11-13 16:50:52 +00:00
|
|
|
case 0xA0000: // fall through to next case
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
if (RoachList[nRoach].nHealth <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-02-27 13:05:55 +00:00
|
|
|
RoachList[nRoach].nHealth -= dmgAdjust(nDamage);
|
2019-08-31 07:47:15 +00:00
|
|
|
if (RoachList[nRoach].nHealth <= 0)
|
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 0;
|
|
|
|
pSprite->zvel = 0;
|
|
|
|
pSprite->cstat &= 0xFEFE;
|
2020-03-02 21:08:31 +00:00
|
|
|
|
|
|
|
RoachList[nRoach].nHealth = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-15 20:42:46 +00:00
|
|
|
if (nAction < 5)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
DropMagic(nSprite);
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[nRoach].nAction = 5;
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2020-03-02 21:08:31 +00:00
|
|
|
|
2020-08-23 12:39:14 +00:00
|
|
|
nCreaturesKilled++; // NOTE: This was incrementing in original code. Bug?
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
short nSprite2 = a & 0xFFFF;
|
2019-11-15 20:42:46 +00:00
|
|
|
if (nSprite2 >= 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-15 20:42:46 +00:00
|
|
|
if (sprite[nSprite2].statnum < 199) {
|
|
|
|
RoachList[nRoach].nTarget = nSprite2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nAction == 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[nRoach].nAction = 2;
|
|
|
|
GoRoach(nSprite);
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-11-15 20:42:46 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!RandomSize(4))
|
|
|
|
{
|
|
|
|
RoachList[nRoach].nAction = 4;
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
2019-11-15 20:42:46 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0x20000:
|
|
|
|
{
|
|
|
|
Gravity(nSprite);
|
|
|
|
|
2020-10-11 09:33:28 +00:00
|
|
|
int nSeq = SeqOffsets[kSeqRoach] + RoachSeq[RoachList[nRoach].nAction].a;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->picnum = seq_GetSeqPicnum2(nSeq, RoachList[nRoach].nFrame);
|
2020-11-29 19:47:55 +00:00
|
|
|
seq_MoveSequence(nSprite, nSeq, RoachList[nRoach].nFrame);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame++;
|
|
|
|
if (RoachList[nRoach].nFrame >= SeqSize[nSeq])
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
bVal = true;
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2020-11-29 19:47:55 +00:00
|
|
|
int nFlag = FrameFlag[SeqBase[nSeq] + RoachList[nRoach].nFrame];
|
2019-08-31 07:47:15 +00:00
|
|
|
short nTarget = RoachList[nRoach].nTarget;
|
|
|
|
|
2019-11-15 20:42:46 +00:00
|
|
|
if (nAction > 5) {
|
2019-08-31 07:47:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-11-15 20:42:46 +00:00
|
|
|
switch (nAction)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
2020-11-29 19:47:55 +00:00
|
|
|
if (RoachList[nRoach].nFrame == 1)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nCount--;
|
|
|
|
if (RoachList[nRoach].nCount <= 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nCount = RandomSize(6);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-13 16:50:52 +00:00
|
|
|
if (((nRoach & 0xF) == (totalmoves & 0xF)) && nTarget < 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
short nTarget = FindPlayer(nSprite, 50);
|
|
|
|
if (nTarget >= 0)
|
|
|
|
{
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[nRoach].nAction = 2;
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
RoachList[nRoach].nTarget = nTarget;
|
|
|
|
GoRoach(nSprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
// partly the same as case 0.
|
2019-11-13 16:50:52 +00:00
|
|
|
if (((nRoach & 0xF) == (totalmoves & 0xF)) && nTarget < 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
short nTarget = FindPlayer(nSprite, 100);
|
|
|
|
if (nTarget >= 0)
|
|
|
|
{
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[nRoach].nAction = 2;
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
RoachList[nRoach].nTarget = nTarget;
|
|
|
|
GoRoach(nSprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
if ((totalmoves & 0xF) == (nRoach & 0xF))
|
|
|
|
{
|
|
|
|
PlotCourseToSprite(nSprite, nTarget);
|
|
|
|
GoRoach(nSprite);
|
|
|
|
}
|
|
|
|
|
2020-03-02 21:08:31 +00:00
|
|
|
int nMov = MoveCreatureWithCaution(nSprite);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-03-02 21:08:31 +00:00
|
|
|
if ((nMov & 0xC000) == 0xC000)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
if ((nMov & 0x3FFF) == nTarget)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
// repeated below
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nIndex = RandomSize(2) + 1;
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[nRoach].nAction = 3;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 0;
|
|
|
|
pSprite->ang = GetMyAngle(sprite[nTarget].x - pSprite->x, sprite[nTarget].y - pSprite->y);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-11-13 16:50:52 +00:00
|
|
|
else
|
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->ang = (pSprite->ang + 256) & kAngleMask;
|
2019-11-13 16:50:52 +00:00
|
|
|
GoRoach(nSprite);
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2020-03-02 21:08:31 +00:00
|
|
|
else if ((nMov & 0xC000) == 0x8000)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->ang = (pSprite->ang + 256) & kAngleMask;
|
2019-08-31 07:47:15 +00:00
|
|
|
GoRoach(nSprite);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-29 19:47:55 +00:00
|
|
|
if (RoachList[nRoach].nCount != 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nCount--;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// same as above
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nIndex = RandomSize(2) + 1;
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[nRoach].nAction = 3;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 0;
|
|
|
|
pSprite->ang = GetMyAngle(sprite[nTarget].x - pSprite->x, sprite[nTarget].y - pSprite->y);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nTarget != -1 && !(sprite[nTarget].cstat & 0x101))
|
|
|
|
{
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[nRoach].nAction = 1;
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
|
|
|
RoachList[nRoach].nCount = 100;
|
2019-08-31 07:47:15 +00:00
|
|
|
RoachList[nRoach].nTarget = -1;
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->xvel = 0;
|
|
|
|
pSprite->yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2019-11-13 16:50:52 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
case 3:
|
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nIndex--;
|
|
|
|
if (RoachList[nRoach].nIndex <= 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[nRoach].nAction = 2;
|
2019-08-31 07:47:15 +00:00
|
|
|
GoRoach(nSprite);
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
|
|
|
RoachList[nRoach].nCount = RandomSize(7);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (nFlag & 0x80)
|
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
BuildBullet(nSprite, 13, 0, 0, -1, pSprite->ang, nTarget + 10000, 1);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[nRoach].nAction = 2;
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].nFrame = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
{
|
2020-03-02 21:08:31 +00:00
|
|
|
if (bVal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-09-06 06:33:02 +00:00
|
|
|
pSprite->cstat = 0;
|
2019-11-15 20:42:46 +00:00
|
|
|
RoachList[nRoach].nAction = 6;
|
2020-11-29 19:47:55 +00:00
|
|
|
RoachList[nRoach].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
|