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"
|
2020-03-02 21:08:31 +00:00
|
|
|
#include "engine.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "sequence.h"
|
|
|
|
#include "view.h"
|
|
|
|
#include "exhumed.h"
|
|
|
|
#include <assert.h>
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2021-11-21 19:48:11 +00:00
|
|
|
int nMinChunk;
|
|
|
|
int nPlayerPic;
|
|
|
|
int nMaxChunk;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-10-11 09:33:28 +00:00
|
|
|
static actionSeq RatSeq[] = {
|
2020-03-02 21:08:31 +00:00
|
|
|
{0, 1},
|
|
|
|
{1, 0},
|
|
|
|
{1, 0},
|
|
|
|
{9, 1},
|
|
|
|
{0, 1}
|
|
|
|
};
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-29 19:39:27 +00:00
|
|
|
void SerializeRat(FSerializer& arc)
|
|
|
|
{
|
|
|
|
if (arc.BeginObject("rat"))
|
|
|
|
{
|
|
|
|
arc("minchunk", nMinChunk)
|
|
|
|
("maxchunk", nMaxChunk)
|
|
|
|
("playerpic", nPlayerPic)
|
|
|
|
.EndObject();
|
|
|
|
}
|
|
|
|
}
|
2019-12-26 21:00:04 +00:00
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
void InitRats()
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
nMinChunk = 9999;
|
|
|
|
nMaxChunk = -1;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-12-05 19:49:28 +00:00
|
|
|
for (int i = 122; i <= 131; i++)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2023-04-15 22:03:23 +00:00
|
|
|
int nPic = getSequence("joe", i).getFirstPicnum();
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
if (nPic < nMinChunk)
|
|
|
|
nMinChunk = nPic;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
if (nPic > nMaxChunk)
|
|
|
|
nMaxChunk = nPic;
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2023-04-15 22:03:23 +00:00
|
|
|
nPlayerPic = getSequence("joe", 120).getFirstPicnum();
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2021-12-23 16:06:48 +00:00
|
|
|
void SetRatVel(DExhumedActor* pActor)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2022-09-03 10:06:50 +00:00
|
|
|
pActor->VelFromAngle(-2);
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-07 07:48:05 +00:00
|
|
|
void BuildRat(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, DAngle nAngle)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2022-08-17 17:03:45 +00:00
|
|
|
if (pActor == nullptr)
|
|
|
|
{
|
|
|
|
pActor = insertActor(pSector, 108);
|
|
|
|
pActor->spr.pos = pos;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ChangeActorStat(pActor, 108);
|
|
|
|
pActor->spr.pos.Z = pActor->sector()->floorz;
|
2022-11-25 12:13:50 +00:00
|
|
|
nAngle = pActor->spr.Angles.Yaw;
|
2022-08-17 17:03:45 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-12-23 16:06:48 +00:00
|
|
|
pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
|
|
|
pActor->spr.shade = -12;
|
|
|
|
pActor->spr.xoffset = 0;
|
|
|
|
pActor->spr.yoffset = 0;
|
|
|
|
pActor->spr.picnum = 1;
|
2021-12-30 15:51:56 +00:00
|
|
|
pActor->spr.pal = pActor->sector()->ceilingpal;
|
2022-10-04 17:13:26 +00:00
|
|
|
pActor->clipdist = 7.5;
|
2022-11-25 12:13:50 +00:00
|
|
|
pActor->spr.Angles.Yaw = nAngle;
|
2022-10-07 21:52:29 +00:00
|
|
|
pActor->spr.scale = DVector2(0.78125, 0.78125);
|
2022-09-03 08:02:25 +00:00
|
|
|
pActor->vel.X = 0;
|
|
|
|
pActor->vel.Y = 0;
|
|
|
|
pActor->vel.Z = 0;
|
2021-12-23 16:06:48 +00:00
|
|
|
pActor->spr.lotag = runlist_HeadRun() + 1;
|
|
|
|
pActor->spr.hitag = 0;
|
|
|
|
pActor->spr.extra = -1;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-09-07 07:48:05 +00:00
|
|
|
if (nAngle.Degrees() >= 0) {
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nAction = 2;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else {
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nAction = 4;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nFrame = 0;
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->pTarget = nullptr;
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nCount = RandomSize(5);
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->nPhase = RandomSize(3);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-05-23 22:30:41 +00:00
|
|
|
pActor->spr.intowner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x240000);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x240000);
|
2023-04-21 11:11:52 +00:00
|
|
|
|
|
|
|
pActor->nSeqFile = "rat";
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-10-17 21:06:15 +00:00
|
|
|
DExhumedActor* FindFood(DExhumedActor* pActor)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
auto pSector = pActor->sector();
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-08-22 16:41:05 +00:00
|
|
|
if (nChunkTotal)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-12-07 17:53:02 +00:00
|
|
|
DExhumedActor* pActor2 = nChunkSprite[RandomSize(7) % nChunkTotal];
|
2021-09-17 07:24:14 +00:00
|
|
|
if (pActor2 != nullptr)
|
|
|
|
{
|
2022-08-22 16:41:05 +00:00
|
|
|
if (cansee(pActor->spr.pos.plusZ(pSector->ceilingz * 0.5), pSector, pActor2->spr.pos, pActor2->sector())) {
|
2021-10-17 21:06:15 +00:00
|
|
|
return pActor2;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!nBodyTotal) {
|
2021-10-17 21:06:15 +00:00
|
|
|
return nullptr;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2021-12-07 17:53:02 +00:00
|
|
|
DExhumedActor* pActor2 = nBodySprite[RandomSize(7) % nBodyTotal];
|
2021-09-17 07:01:17 +00:00
|
|
|
if (pActor2 != nullptr)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-12-23 16:26:44 +00:00
|
|
|
if (nPlayerPic == pActor2->spr.picnum)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2022-08-22 16:41:05 +00:00
|
|
|
if (cansee(pActor->spr.pos, pSector, pActor2->spr.pos, pActor2->sector())) {
|
2021-10-17 21:06:15 +00:00
|
|
|
return pActor2;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-17 21:06:15 +00:00
|
|
|
return nullptr;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-10-15 21:00:02 +00:00
|
|
|
void AIRat::RadialDamage(RunListEvent* ev)
|
|
|
|
{
|
2021-10-17 21:06:15 +00:00
|
|
|
auto pActor = ev->pObjActor;
|
|
|
|
if (!pActor) return;
|
|
|
|
|
|
|
|
ev->nDamage = runlist_CheckRadialDamage(pActor);
|
2021-10-15 21:00:02 +00:00
|
|
|
Damage(ev);
|
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-10-15 21:00:02 +00:00
|
|
|
void AIRat::Damage(RunListEvent* ev)
|
|
|
|
{
|
2021-10-17 21:06:15 +00:00
|
|
|
auto pActor = ev->pObjActor;
|
|
|
|
if (!pActor) return;
|
2021-10-15 21:00:02 +00:00
|
|
|
|
|
|
|
if (ev->nDamage)
|
|
|
|
{
|
2021-12-23 16:06:48 +00:00
|
|
|
pActor->spr.cstat = 0;
|
2022-09-03 08:02:25 +00:00
|
|
|
pActor->vel.X = 0;
|
|
|
|
pActor->vel.Y = 0;
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nAction = 3;
|
|
|
|
pActor->nFrame = 0;
|
2021-10-15 21:00:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-10-15 21:00:02 +00:00
|
|
|
void AIRat::Draw(RunListEvent* ev)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2023-04-21 11:11:52 +00:00
|
|
|
if (const auto pActor = ev->pObjActor)
|
|
|
|
{
|
|
|
|
const auto ratSeq = &RatSeq[pActor->nAction];
|
|
|
|
seq_PlotSequence(ev->nParam, pActor->nSeqFile, ratSeq->nSeqId, pActor->nFrame, ratSeq->nFlags);
|
|
|
|
}
|
2021-10-15 21:00:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-10-15 21:00:02 +00:00
|
|
|
void AIRat::Tick(RunListEvent* ev)
|
|
|
|
{
|
2022-09-09 16:37:10 +00:00
|
|
|
constexpr double CHECK_DIST = 50/16.;
|
2021-10-17 21:06:15 +00:00
|
|
|
auto pActor = ev->pObjActor;
|
|
|
|
if (!pActor) return;
|
|
|
|
|
2021-11-21 19:48:11 +00:00
|
|
|
int nAction = pActor->nAction;
|
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
|
|
|
|
2023-04-16 07:08:33 +00:00
|
|
|
const auto& ratSeq = getSequence(pActor->nSeqFile, RatSeq[nAction].nSeqId);
|
2023-04-15 22:03:23 +00:00
|
|
|
const auto& seqFrame = ratSeq.frames[pActor->nFrame];
|
2021-10-15 21:00:02 +00:00
|
|
|
|
2023-04-15 10:25:40 +00:00
|
|
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
2023-04-16 07:08:33 +00:00
|
|
|
|
2023-04-15 11:48:48 +00:00
|
|
|
seqFrame.playSound(pActor);
|
2021-10-15 21:00:02 +00:00
|
|
|
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nFrame++;
|
2023-04-15 22:03:23 +00:00
|
|
|
if (pActor->nFrame >= ratSeq.frames.Size())
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-15 21:00:02 +00:00
|
|
|
bVal = true;
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nFrame = 0;
|
2021-10-15 21:00:02 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-12-07 17:53:02 +00:00
|
|
|
DExhumedActor* pTarget = pActor->pTarget;
|
2021-10-15 21:00:02 +00:00
|
|
|
|
2021-10-17 21:06:15 +00:00
|
|
|
Gravity(pActor);
|
2021-10-15 21:00:02 +00:00
|
|
|
|
|
|
|
switch (nAction)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
{
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nCount--;
|
|
|
|
if (pActor->nCount > 0) {
|
2019-12-05 19:49:28 +00:00
|
|
|
return;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2022-09-09 16:37:10 +00:00
|
|
|
auto delta = pActor->spr.pos.XY() - pTarget->spr.pos.XY();
|
2021-10-15 21:00:02 +00:00
|
|
|
|
2022-09-09 16:37:10 +00:00
|
|
|
if (abs(delta.X) > CHECK_DIST || abs(delta.Y) >= CHECK_DIST)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nAction = 2;
|
|
|
|
pActor->nFrame = 0;
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->pTarget = nullptr;
|
2021-10-15 21:00:02 +00:00
|
|
|
|
2022-09-03 08:02:25 +00:00
|
|
|
pActor->vel.X = 0;
|
|
|
|
pActor->vel.Y = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nFrame ^= 1;
|
|
|
|
pActor->nCount = RandomSize(5) + 4;
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->nPhase--;
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2021-10-17 21:06:15 +00:00
|
|
|
if (pActor->nPhase <= 0)
|
2021-10-15 21:00:02 +00:00
|
|
|
{
|
2021-10-17 21:06:15 +00:00
|
|
|
auto pFoodSprite = FindFood(pActor);
|
|
|
|
if (pFoodSprite == nullptr) {
|
2021-10-15 21:00:02 +00:00
|
|
|
return;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->pTarget = pFoodSprite;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 21:06:15 +00:00
|
|
|
PlotCourseToSprite(pActor, pFoodSprite);
|
2021-12-23 16:06:48 +00:00
|
|
|
SetRatVel(pActor);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nAction = 1;
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->nPhase = 900;
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nFrame = 0;
|
2021-10-15 21:00:02 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 21:00:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->nPhase--;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 21:06:15 +00:00
|
|
|
if (pActor->nPhase <= 0)
|
2021-10-15 21:00:02 +00:00
|
|
|
{
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nAction = 2;
|
|
|
|
pActor->nFrame = 0;
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->pTarget = nullptr;
|
2021-10-15 21:00:02 +00:00
|
|
|
|
2022-09-03 08:02:25 +00:00
|
|
|
pActor->vel.X = 0;
|
|
|
|
pActor->vel.Y = 0;
|
2021-10-15 21:00:02 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 21:06:15 +00:00
|
|
|
MoveCreature(pActor);
|
2019-12-05 19:49:28 +00:00
|
|
|
|
2022-09-09 16:37:10 +00:00
|
|
|
auto delta = pActor->spr.pos.XY() - pTarget->spr.pos.XY();
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-09-09 16:37:10 +00:00
|
|
|
if (abs(delta.X) > CHECK_DIST || abs(delta.Y) >= CHECK_DIST)
|
2021-10-15 21:00:02 +00:00
|
|
|
{
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nCount--;
|
|
|
|
if (pActor->nCount < 0)
|
2021-10-15 21:00:02 +00:00
|
|
|
{
|
2021-10-17 21:06:15 +00:00
|
|
|
PlotCourseToSprite(pActor, pTarget);
|
2021-12-23 16:06:48 +00:00
|
|
|
SetRatVel(pActor);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nCount = 32;
|
2021-10-15 21:00:02 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 21:00:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nAction = 0;
|
|
|
|
pActor->nFrame = 0;
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->nPhase = RandomSize(3);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-09-03 08:02:25 +00:00
|
|
|
pActor->vel.X = 0;
|
|
|
|
pActor->vel.Y = 0;
|
2021-10-15 21:00:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
2022-09-03 08:03:30 +00:00
|
|
|
if (pActor->vel.X != 0 || pActor->vel.Y != 0 || pActor->vel.Z != 0) {
|
2021-10-17 21:06:15 +00:00
|
|
|
MoveCreature(pActor);
|
2021-10-15 21:00:02 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nCount--;
|
|
|
|
if (pActor->nCount <= 0)
|
2021-10-15 21:00:02 +00:00
|
|
|
{
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->pTarget = FindFood(pActor);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-17 21:06:15 +00:00
|
|
|
if (pActor->pTarget == nullptr)
|
2021-10-15 21:00:02 +00:00
|
|
|
{
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nCount = RandomSize(6);
|
2022-09-03 08:03:30 +00:00
|
|
|
if (pActor->vel.X != 0 || pActor->vel.Y != 0)
|
2021-10-15 21:00:02 +00:00
|
|
|
{
|
2022-09-03 08:02:25 +00:00
|
|
|
pActor->vel.X = 0;
|
|
|
|
pActor->vel.Y = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-11-25 12:13:50 +00:00
|
|
|
pActor->spr.Angles.Yaw = RandomAngle();
|
2021-12-23 16:06:48 +00:00
|
|
|
SetRatVel(pActor);
|
2021-10-15 21:00:02 +00:00
|
|
|
return;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-10-15 21:00:02 +00:00
|
|
|
else
|
|
|
|
{
|
2021-10-17 21:06:15 +00:00
|
|
|
PlotCourseToSprite(pActor, pActor->pTarget);
|
2021-12-23 16:06:48 +00:00
|
|
|
SetRatVel(pActor);
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nAction = 1;
|
2021-10-17 21:06:15 +00:00
|
|
|
pActor->nPhase = 900;
|
2021-10-23 19:50:57 +00:00
|
|
|
pActor->nFrame = 0;
|
2021-10-15 21:00:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 21:00:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
if (bVal)
|
|
|
|
{
|
2022-05-23 22:30:41 +00:00
|
|
|
runlist_DoSubRunRec(pActor->spr.intowner);
|
2021-12-23 16:06:48 +00:00
|
|
|
runlist_FreeRun(pActor->spr.lotag - 1);
|
2021-10-23 19:50:57 +00:00
|
|
|
runlist_SubRunRec(pActor->nRun);
|
2021-10-15 21:00:02 +00:00
|
|
|
|
2021-12-23 16:06:48 +00:00
|
|
|
pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
2021-10-17 21:06:15 +00:00
|
|
|
DeleteActor(pActor);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-10-15 21:00:02 +00:00
|
|
|
return;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-10-15 21:00:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|