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 "engine.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "exhumed.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "sequence.h"
|
|
|
|
#include <assert.h>
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
void DestroyGrenade(DExhumedActor* pActor)
|
2020-11-30 00:10:52 +00:00
|
|
|
{
|
2021-10-20 21:33:08 +00:00
|
|
|
runlist_DoSubRunRec(pActor->nPhase);
|
|
|
|
runlist_SubRunRec(pActor->nRun);
|
2021-12-21 22:18:23 +00:00
|
|
|
runlist_DoSubRunRec(pActor->spr.lotag - 1);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
DeleteActor(pActor);
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-10 18:24:18 +00:00
|
|
|
void BounceGrenade(DExhumedActor* pActor, DAngle nAngle)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nTurn >>= 1;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-09-10 21:06:03 +00:00
|
|
|
pActor->vec = nAngle.ToVector() * pActor->nTurn / 512.;
|
2021-10-20 21:55:00 +00:00
|
|
|
D3PlayFX(StaticSound[kSound3], pActor);
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-27 04:12:16 +00:00
|
|
|
void ThrowGrenade(int nPlayer, double dz, double push1)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2021-10-21 17:44:53 +00:00
|
|
|
if (PlayerList[nPlayer].pPlayerGrenade == nullptr)
|
2021-10-20 21:55:00 +00:00
|
|
|
return;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-12-07 17:53:02 +00:00
|
|
|
DExhumedActor* pActor = PlayerList[nPlayer].pPlayerGrenade;
|
2021-12-26 07:47:54 +00:00
|
|
|
auto pPlayerActor = PlayerList[nPlayer].pActor;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-11-25 12:13:50 +00:00
|
|
|
DAngle nAngle = pPlayerActor->spr.Angles.Yaw;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-22 23:20:15 +00:00
|
|
|
ChangeActorSect(pActor, PlayerList[nPlayer].pPlayerViewSect);
|
2019-11-28 00:30:21 +00:00
|
|
|
|
2022-08-16 21:46:18 +00:00
|
|
|
pActor->spr.pos = pPlayerActor->spr.pos;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-09-10 18:24:18 +00:00
|
|
|
if (nAngle < nullAngle) {
|
2022-11-25 12:13:50 +00:00
|
|
|
nAngle = pPlayerActor->spr.Angles.Yaw;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-12-23 21:51:26 +00:00
|
|
|
pActor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
2022-11-25 12:13:50 +00:00
|
|
|
pActor->spr.Angles.Yaw = nAngle;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-10-11 06:46:56 +00:00
|
|
|
if (push1 <= 23.4375)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-21 10:51:16 +00:00
|
|
|
int nVel = PlayerList[nPlayer].totalvel << 5;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nTurn = ((90 - pActor->nIndex2) * (90 - pActor->nIndex2)) + nVel;
|
2022-10-11 06:46:56 +00:00
|
|
|
pActor->vel.Z = ((32. * push1) - 17);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-09-10 18:24:18 +00:00
|
|
|
|
2022-10-04 17:06:49 +00:00
|
|
|
DVector2 vec = nAngle.ToVector() * pPlayerActor->clipdist *2; // == << 14 + 3 + 2 - 18
|
2022-09-10 20:39:40 +00:00
|
|
|
auto nMov = movesprite(pActor, vec, dz, 0, CLIPMASK1);
|
2021-10-20 21:55:00 +00:00
|
|
|
if (nMov.type == kHitWall)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-11-26 13:26:03 +00:00
|
|
|
nAngle = GetWallNormal(nMov.hitWall);
|
2021-10-20 21:55:00 +00:00
|
|
|
BounceGrenade(pActor, nAngle);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nTurn = 0;
|
2022-09-09 17:29:11 +00:00
|
|
|
pActor->vel.Z = pPlayerActor->vel.Z;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-09-10 21:06:03 +00:00
|
|
|
pActor->vec = nAngle.ToVector() * pActor->nTurn / 256;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-10-21 17:44:53 +00:00
|
|
|
PlayerList[nPlayer].pPlayerGrenade = nullptr;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
return;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-10-15 16:37:39 +00:00
|
|
|
void BuildGrenade(int nPlayer)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2021-11-22 23:20:15 +00:00
|
|
|
auto pActor = insertActor(PlayerList[nPlayer].pPlayerViewSect, 201);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-12-26 07:47:54 +00:00
|
|
|
auto pPlayerActor = PlayerList[nPlayer].pActor;
|
2021-09-06 06:33:02 +00:00
|
|
|
|
2022-08-16 21:46:18 +00:00
|
|
|
pActor->spr.pos = pPlayerActor->spr.pos.plusZ(-15);
|
2021-12-23 16:03:02 +00:00
|
|
|
pActor->spr.shade = -64;
|
2022-10-07 21:52:29 +00:00
|
|
|
pActor->spr.scale = DVector2(0.34375, 0.3125);
|
2021-12-23 16:03:02 +00:00
|
|
|
pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
|
|
|
pActor->spr.picnum = 1;
|
|
|
|
pActor->spr.pal = 0;
|
2022-10-04 17:13:26 +00:00
|
|
|
pActor->clipdist = 7.5;
|
2021-12-23 16:03:02 +00:00
|
|
|
pActor->spr.xoffset = 0;
|
|
|
|
pActor->spr.yoffset = 0;
|
2022-11-25 12:13:50 +00:00
|
|
|
pActor->spr.Angles.Yaw = pPlayerActor->spr.Angles.Yaw;
|
2022-05-23 22:30:41 +00:00
|
|
|
pActor->spr.intowner = nPlayer;
|
2022-09-03 08:02:25 +00:00
|
|
|
pActor->vel.X = 0;
|
|
|
|
pActor->vel.Y = 0;
|
|
|
|
pActor->vel.Z = 0;
|
2021-12-23 16:03:02 +00:00
|
|
|
pActor->spr.hitag = 0;
|
|
|
|
pActor->spr.lotag = runlist_HeadRun() + 1;
|
|
|
|
pActor->spr.extra = -1;
|
2021-12-30 16:10:08 +00:00
|
|
|
pActor->backuppos();
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
// GrabTimeSlot(3);
|
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nIndex2 = 90;
|
|
|
|
pActor->nHealth = 0;
|
|
|
|
pActor->nCount = 16;
|
|
|
|
pActor->nTurn = -1;
|
|
|
|
pActor->nIndex = 0;
|
|
|
|
pActor->nFrame = 0;
|
2021-12-23 16:03:02 +00:00
|
|
|
pActor->nPhase = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x0F0000);
|
2021-10-20 21:55:00 +00:00
|
|
|
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x0F0000);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-10-21 17:44:53 +00:00
|
|
|
PlayerList[nPlayer].pPlayerGrenade = pActor;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
void ExplodeGrenade(DExhumedActor* pActor)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2022-10-07 17:40:27 +00:00
|
|
|
int var_28;
|
|
|
|
double scale;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-05-23 22:30:41 +00:00
|
|
|
int nPlayer = pActor->spr.intowner;
|
2021-12-30 15:51:56 +00:00
|
|
|
auto pGrenadeSect = pActor->sector();
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nFrame = 1;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-11-22 22:16:21 +00:00
|
|
|
if (pGrenadeSect->Flag & kSectUnderwater)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
var_28 = 75;
|
2022-10-07 17:40:27 +00:00
|
|
|
scale = 0.9375;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-08-20 15:53:53 +00:00
|
|
|
if (pActor->spr.pos.Z < pGrenadeSect->floorz)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2022-10-07 17:40:27 +00:00
|
|
|
scale = 3.125;
|
2019-08-31 07:47:15 +00:00
|
|
|
var_28 = 36;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
// TODO MonoOut("GRENPOW\n");
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var_28 = 34;
|
2022-10-07 17:40:27 +00:00
|
|
|
scale = 2.3475;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
// TODO MonoOut("GRENBOOM\n");
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
if (pActor->nTurn < 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-12-26 07:47:54 +00:00
|
|
|
auto pPlayerActor = PlayerList[nPlayer].pActor;
|
2022-11-25 12:13:50 +00:00
|
|
|
auto nAngle = pPlayerActor->spr.Angles.Yaw;
|
2022-08-20 15:53:53 +00:00
|
|
|
|
|
|
|
DVector2 vect = nAngle.ToVector() * 32;
|
|
|
|
pActor->spr.pos = pPlayerActor->spr.pos + vect;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
ChangeActorSect(pActor, pPlayerActor->sector());
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
if (!PlayerList[nPlayer].invincibility) {
|
|
|
|
PlayerList[nPlayer].nHealth = 1;
|
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:34:15 +00:00
|
|
|
int nDamage = BulletInfo[kWeaponGrenade].nDamage;
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2021-05-13 17:15:53 +00:00
|
|
|
if (PlayerList[nPlayer].nDouble > 0) {
|
2019-08-31 07:47:15 +00:00
|
|
|
nDamage *= 2;
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
runlist_RadialDamageEnemy(pActor, nDamage, BulletInfo[kWeaponGrenade].nRadius);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-10-07 17:40:27 +00:00
|
|
|
BuildAnim(nullptr, var_28, 0, pActor->spr.pos, pActor->sector(), scale, 4);
|
2022-08-20 14:19:07 +00:00
|
|
|
AddFlash(pActor->sector(), pActor->spr.pos, 128);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
DestroyGrenade(pActor);
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-10-15 19:20:28 +00:00
|
|
|
void AIGrenade::Draw(RunListEvent* ev)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2021-10-20 21:55:00 +00:00
|
|
|
auto pActor = ev->pObjActor;
|
|
|
|
if (!pActor) return;
|
|
|
|
|
2021-11-21 19:34:15 +00:00
|
|
|
int nSeq = pActor->nFrame ? SeqOffsets[kSeqGrenBoom] : SeqOffsets[kSeqGrenRoll] + pActor->nIndex;
|
2021-10-20 21:33:08 +00:00
|
|
|
seq_PlotSequence(ev->nParam, nSeq, pActor->nHealth >> 8, 1);
|
2021-10-15 19:20:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-10-15 19:20:28 +00:00
|
|
|
void AIGrenade::Tick(RunListEvent* ev)
|
|
|
|
{
|
2021-10-20 21:55:00 +00:00
|
|
|
auto pActor = ev->pObjActor;
|
|
|
|
if (!pActor) return;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-11-21 19:34:15 +00:00
|
|
|
int nSeq = pActor->nFrame ? SeqOffsets[kSeqGrenBoom] : SeqOffsets[kSeqGrenRoll] + pActor->nIndex;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
seq_MoveSequence(pActor, nSeq, pActor->nHealth >> 8);
|
2021-12-23 17:11:53 +00:00
|
|
|
pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nHealth >> 8);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nIndex2--;
|
|
|
|
if (!pActor->nIndex2)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2022-05-23 22:30:41 +00:00
|
|
|
int nPlayer = pActor->spr.intowner;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
if (pActor->nTurn < 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-11-21 18:33:51 +00:00
|
|
|
PlayerList[nPlayer].nState = 0;
|
|
|
|
PlayerList[nPlayer].nSeqSize2 = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 19:20:28 +00:00
|
|
|
if (PlayerList[nPlayer].nAmmo[kWeaponGrenade])
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-15 19:20:28 +00:00
|
|
|
PlayerList[nPlayer].bIsFiring = false;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-15 19:20:28 +00:00
|
|
|
SelectNewWeapon(nPlayer);
|
|
|
|
|
2021-11-21 18:33:51 +00:00
|
|
|
PlayerList[nPlayer].nCurrentWeapon = PlayerList[nPlayer].nNextWeapon;
|
|
|
|
PlayerList[nPlayer].nNextWeapon = -1;
|
2021-10-15 19:20:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
ExplodeGrenade(pActor);
|
2021-10-15 19:20:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-20 21:33:08 +00:00
|
|
|
if (pActor->nTurn < 0) {
|
2021-10-15 19:20:28 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
int ebp = (pActor->nHealth + pActor->nCount) >> 8;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nHealth += pActor->nCount;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-15 19:20:28 +00:00
|
|
|
if (ebp < 0)
|
|
|
|
{
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nHealth += SeqSize[nSeq] << 8;
|
2021-10-15 19:20:28 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ebp >= SeqSize[nSeq])
|
|
|
|
{
|
2021-10-20 21:33:08 +00:00
|
|
|
if (pActor->nFrame)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-20 21:55:00 +00:00
|
|
|
DestroyGrenade(pActor);
|
2021-10-15 19:20:28 +00:00
|
|
|
return;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nHealth = pActor->nFrame;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-10-15 19:20:28 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
if (pActor->nFrame) {
|
2021-10-15 19:20:28 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-09-10 21:06:03 +00:00
|
|
|
double zVel = pActor->vel.Z;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
Gravity(pActor);
|
2022-10-04 17:06:49 +00:00
|
|
|
auto nMov = movesprite(pActor, pActor->vec, pActor->vel.Z, pActor->clipdist / 128., CLIPMASK1);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
if (!nMov.type && !nMov.exbits)
|
2021-10-15 19:20:28 +00:00
|
|
|
return;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
if (nMov.exbits & kHitAux2)
|
2021-10-15 19:20:28 +00:00
|
|
|
{
|
|
|
|
if (zVel)
|
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
if (pActor->sector()->Damage > 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-20 21:55:00 +00:00
|
|
|
ExplodeGrenade(pActor);
|
2021-10-15 19:20:28 +00:00
|
|
|
return;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nCount = (uint8_t)totalmoves; // limit to 8bits?
|
2021-10-15 19:20:28 +00:00
|
|
|
|
2021-10-20 21:55:00 +00:00
|
|
|
D3PlayFX(StaticSound[kSound3], pActor);
|
2021-10-15 19:20:28 +00:00
|
|
|
|
2022-09-10 21:06:03 +00:00
|
|
|
pActor->vel.Z = -zVel * 0.5;
|
2021-10-15 19:20:28 +00:00
|
|
|
|
2022-09-03 08:03:30 +00:00
|
|
|
if (pActor->vel.Z > -5)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-20 21:55:00 +00:00
|
|
|
D3PlayFX(StaticSound[kSound5], pActor);
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nCount = 0;
|
|
|
|
pActor->nHealth = 0;
|
2022-09-03 08:02:25 +00:00
|
|
|
pActor->vel.Z = 0;
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nIndex = 1;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nCount = 255 - (RandomByte() * 2);
|
2022-09-10 18:51:42 +00:00
|
|
|
pActor->vec *= (15./16.);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2021-10-15 19:20:28 +00:00
|
|
|
// loc_2CF60:
|
2021-10-20 21:55:00 +00:00
|
|
|
if (nMov.type == kHitWall)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-11-26 13:26:03 +00:00
|
|
|
BounceGrenade(pActor, GetWallNormal(nMov.hitWall));
|
2021-10-20 21:55:00 +00:00
|
|
|
}
|
|
|
|
else if (nMov.type == kHitSprite)
|
|
|
|
{
|
2022-11-25 12:13:50 +00:00
|
|
|
BounceGrenade(pActor, nMov.actor()->spr.Angles.Yaw);
|
2021-10-15 19:20:28 +00:00
|
|
|
}
|
|
|
|
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nHealth = 0;
|
2021-10-15 19:20:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-10-15 19:20:28 +00:00
|
|
|
void AIGrenade::RadialDamage(RunListEvent* ev)
|
|
|
|
{
|
2021-10-20 21:55:00 +00:00
|
|
|
auto pActor = ev->pObjActor;
|
|
|
|
if (!pActor) return;
|
2021-10-15 19:20:28 +00:00
|
|
|
|
2021-11-30 21:44:54 +00:00
|
|
|
if (pActor != ev->pRadialActor && !pActor->nFrame)
|
2021-10-15 19:20:28 +00:00
|
|
|
{
|
2021-10-20 21:55:00 +00:00
|
|
|
if (runlist_CheckRadialDamage(pActor) > 280)
|
2021-10-15 19:20:28 +00:00
|
|
|
{
|
2021-10-20 21:33:08 +00:00
|
|
|
pActor->nIndex2 = RandomSize(4) + 1;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
2021-10-15 19:20:28 +00:00
|
|
|
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|