2020-05-14 10:14:03 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2017-2019 Nuke.YKT
|
2020-06-28 07:03:31 +00:00
|
|
|
Copyright (C) 2020 - Christoph Oelckers
|
2020-05-14 10:14:03 +00:00
|
|
|
|
|
|
|
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
|
|
|
|
|
|
|
Duke Nukem 3D is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Original Source: 1996 - Todd Replogle
|
|
|
|
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "ns.h"
|
|
|
|
#include "global.h"
|
2020-07-03 21:56:14 +00:00
|
|
|
#include "names_r.h"
|
2020-07-07 15:56:20 +00:00
|
|
|
#include "mapinfo.h"
|
2020-10-21 17:14:41 +00:00
|
|
|
#include "dukeactor.h"
|
2020-05-14 10:14:03 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2020-07-16 15:59:25 +00:00
|
|
|
|
2020-05-16 21:55:21 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-02-07 10:04:19 +00:00
|
|
|
void incur_damage_r(player_struct* p)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-11-14 14:03:50 +00:00
|
|
|
int damage = 0, shield_damage = 0;
|
2021-11-07 13:36:39 +00:00
|
|
|
int gut = 0;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
p->GetActor()->spr.extra -= p->extra_extra8 >> 8;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
damage = p->GetActor()->spr.extra - p->last_extra;
|
2020-05-16 21:55:21 +00:00
|
|
|
if (damage < 0)
|
|
|
|
{
|
|
|
|
p->extra_extra8 = 0;
|
|
|
|
|
|
|
|
if (p->steroids_amount > 0 && p->steroids_amount < 400)
|
|
|
|
{
|
|
|
|
shield_damage = damage * (20 + (krand() % 30)) / 100;
|
|
|
|
damage -= shield_damage;
|
|
|
|
}
|
|
|
|
if (p->drink_amt > 31 && p->drink_amt < 65)
|
|
|
|
gut++;
|
|
|
|
if (p->eat > 31 && p->eat < 65)
|
|
|
|
gut++;
|
|
|
|
|
|
|
|
switch (gut)
|
|
|
|
{
|
|
|
|
case 1:
|
2021-05-12 15:33:33 +00:00
|
|
|
damage = damage * 3 / 4;
|
2020-05-16 21:55:21 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-05-12 15:33:33 +00:00
|
|
|
damage /= 4;
|
2020-05-16 21:55:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
p->GetActor()->spr.extra = p->last_extra + damage;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-13 21:00:32 +00:00
|
|
|
static void shootmelee(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atwith)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = actor->sector();
|
2022-10-11 03:34:30 +00:00
|
|
|
double vel = 1024., zvel;
|
2021-12-06 11:24:22 +00:00
|
|
|
HitInfo hit{};
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (p >= 0)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-11-25 11:24:32 +00:00
|
|
|
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
|
2022-09-13 21:00:32 +00:00
|
|
|
pos.Z += 6;
|
|
|
|
ang += DAngle1 * 2.64;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-13 21:00:32 +00:00
|
|
|
double x;
|
|
|
|
auto pactor = ps[findplayer(actor, &x)].GetActor();
|
|
|
|
zvel = ((pactor->spr.pos.Z - pos.Z) * 16) / (x + 1 / 16.);
|
2022-09-30 11:38:21 +00:00
|
|
|
ang = (pactor->spr.pos.XY() - pos.XY()).Angle();
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
2022-10-11 03:34:30 +00:00
|
|
|
hitscan(pos, sectp, DVector3(ang.ToVector() * vel, zvel * 64), hit, CLIPMASK1);
|
2020-09-17 21:02:52 +00:00
|
|
|
|
2022-11-30 18:49:59 +00:00
|
|
|
if (isRRRA() && hit.hitSector != nullptr && ((hit.hitSector->lotag == ST_160_FLOOR_TELEPORT && zvel > 0) || (hit.hitSector->lotag == ST_161_CEILING_TELEPORT && zvel < 0))
|
2021-11-25 23:08:59 +00:00
|
|
|
&& hit.actor() == nullptr && hit.hitWall == nullptr)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-11-17 23:01:29 +00:00
|
|
|
DukeStatIterator its(STAT_EFFECTOR);
|
2020-10-24 04:58:52 +00:00
|
|
|
while (auto effector = its.Next())
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-12-01 19:54:41 +00:00
|
|
|
if (effector->sector() == hit.hitSector && iseffector(effector) && effector->GetOwner()
|
2021-12-21 17:19:45 +00:00
|
|
|
&& effector->spr.lotag == SE_7_TELEPORT)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-09-12 19:26:17 +00:00
|
|
|
DVector3 npos;
|
|
|
|
npos.XY() = hit.hitpos.XY() + (effector->GetOwner()->spr.pos.XY() - effector->spr.pos.XY());
|
2022-11-30 18:49:59 +00:00
|
|
|
if (hit.hitSector->lotag == ST_161_CEILING_TELEPORT)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-09-12 19:26:17 +00:00
|
|
|
npos.Z = effector->GetOwner()->sector()->floorz;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-12 19:26:17 +00:00
|
|
|
npos.Z = effector->GetOwner()->sector()->ceilingz;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2022-09-12 19:26:17 +00:00
|
|
|
hitscan(npos, effector->GetOwner()->sector(), DVector3(ang.ToVector() * 1024, zvel * 0.25), hit, CLIPMASK1);
|
2020-10-20 23:03:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitSector == nullptr) return;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-09-13 21:00:32 +00:00
|
|
|
if ((pos.XY() - hit.hitpos.XY()).Sum() < 64)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitWall != nullptr || hit.actor())
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-24 04:58:52 +00:00
|
|
|
DDukeActor* wpn;
|
2022-12-04 13:16:44 +00:00
|
|
|
if (isRRRA() && atwith == RTILE_SLINGBLADE)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
wpn = CreateActor(hit.hitSector, hit.hitpos, RTILE_SLINGBLADE, -15, DVector2(0, 0), ang, 32., 0., actor, 4);
|
2021-11-19 08:47:17 +00:00
|
|
|
if (!wpn) return;
|
2021-12-21 17:19:45 +00:00
|
|
|
wpn->spr.extra += 50;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
wpn = CreateActor(hit.hitSector, hit.hitpos, RTILE_KNEE, -15, DVector2(0, 0), ang, 32., 0., actor, 4);
|
2021-11-19 08:47:17 +00:00
|
|
|
if (!wpn) return;
|
2021-12-21 17:19:45 +00:00
|
|
|
wpn->spr.extra += (krand() & 7);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
if (p >= 0)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
auto k = spawn(wpn, RTILE_SMALLSMOKE);
|
2022-02-07 07:47:18 +00:00
|
|
|
if (k) k->spr.pos.Z -= 8;
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith == RTILE_KNEE) S_PlayActorSound(KICK_HIT, wpn);
|
|
|
|
else if (isRRRA() && atwith == RTILE_SLINGBLADE) S_PlayActorSound(260, wpn);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400)
|
2021-12-21 17:19:45 +00:00
|
|
|
wpn->spr.extra += (gs.max_player_health >> 2);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-12-10 23:23:38 +00:00
|
|
|
if (hit.actor() && !isaccessswitch(hit.actor()->spr.spritetexture()))
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-11-25 23:08:59 +00:00
|
|
|
fi.checkhitsprite(hit.actor(), wpn);
|
2022-12-11 14:42:33 +00:00
|
|
|
if (p >= 0) checkhitswitch(p, nullptr, hit.actor());
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2021-11-25 23:08:59 +00:00
|
|
|
else if (hit.hitWall)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-12-18 14:11:21 +00:00
|
|
|
if (hit.hitWall->cstat & CSTAT_WALL_BOTTOM_SWAP)
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitWall->twoSided())
|
2022-08-28 09:34:54 +00:00
|
|
|
if (hit.hitpos.Z >= hit.hitWall->nextSector()->floorz)
|
2021-11-25 23:08:59 +00:00
|
|
|
hit.hitWall = hit.hitWall->nextWall();
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-12-10 18:03:17 +00:00
|
|
|
if (!isaccessswitch(hit.hitWall->walltexture))
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-12-05 10:27:25 +00:00
|
|
|
checkhitwall(wpn, hit.hitWall, hit.hitpos);
|
2022-12-11 14:42:33 +00:00
|
|
|
if (p >= 0) checkhitswitch(p, hit.hitWall, nullptr);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
}
|
2021-11-25 23:08:59 +00:00
|
|
|
else if (p >= 0 && zvel > 0 && hit.hitSector->lotag == 1)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
auto splash = spawn(ps[p].GetActor(), RTILE_WATERSPLASH2);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (splash)
|
|
|
|
{
|
2022-08-29 17:30:19 +00:00
|
|
|
splash->spr.pos.XY() = hit.hitpos.XY();
|
2022-11-27 00:13:43 +00:00
|
|
|
splash->spr.Angles.Yaw = ps[p].GetActor()->spr.Angles.Yaw;
|
2022-09-03 08:05:20 +00:00
|
|
|
splash->vel.X = 2;
|
2021-11-19 11:32:12 +00:00
|
|
|
ssp(actor, 0);
|
2022-09-03 08:02:25 +00:00
|
|
|
splash->vel.X = 0;
|
2021-11-19 11:32:12 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-09-27 01:45:37 +00:00
|
|
|
static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atwith)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = actor->sector();
|
2022-10-11 03:36:18 +00:00
|
|
|
double vel = 1024., zvel = 0;
|
2021-12-06 11:24:22 +00:00
|
|
|
HitInfo hit{};
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-12-21 19:56:37 +00:00
|
|
|
if (actor->spr.extra >= 0) actor->spr.shade = -96;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (p >= 0)
|
|
|
|
{
|
2020-11-01 19:57:02 +00:00
|
|
|
auto aimed = aim(actor, AUTO_AIM_ANGLE);
|
|
|
|
if (aimed)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-12-06 20:49:04 +00:00
|
|
|
auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture());
|
|
|
|
double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) + 5;
|
2022-09-27 01:45:37 +00:00
|
|
|
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
|
|
|
|
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * 16) / dist;
|
2022-09-30 11:51:37 +00:00
|
|
|
ang = (aimed->spr.pos - pos).Angle();
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith == RTILE_SHOTSPARK1)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2020-11-01 19:57:02 +00:00
|
|
|
if (aimed == nullptr)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-09-27 01:45:37 +00:00
|
|
|
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
|
2022-11-25 11:24:32 +00:00
|
|
|
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
|
2022-10-24 19:25:45 +00:00
|
|
|
zvel += 0.5 - krandf(1);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith == RTILE_SHOTGUN)
|
2022-09-27 01:45:37 +00:00
|
|
|
ang += DAngle22_5 / 2 - randomAngle(22.5);
|
2020-05-16 21:55:21 +00:00
|
|
|
else
|
2022-09-27 01:45:37 +00:00
|
|
|
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
|
2022-11-25 11:24:32 +00:00
|
|
|
if (aimed == nullptr) setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
|
2022-09-27 01:45:37 +00:00
|
|
|
zvel += 0.5 - krandf(1);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2022-09-27 01:45:37 +00:00
|
|
|
pos.Z -= 2;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-27 01:45:37 +00:00
|
|
|
double x;
|
2020-11-01 19:57:02 +00:00
|
|
|
int j = findplayer(actor, &x);
|
2022-09-27 01:45:37 +00:00
|
|
|
pos.Z -= 4;
|
|
|
|
double dist = (ps[j].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Length();
|
2022-11-21 04:20:08 +00:00
|
|
|
zvel = ((ps[j].GetActor()->getOffsetZ() - pos.Z) * 16) / dist;
|
2022-11-29 19:55:02 +00:00
|
|
|
zvel += 0.5 - krandf(1);
|
|
|
|
ang += DAngle22_5 / 4 - randomAngle(22.5 / 2);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-12-21 19:56:37 +00:00
|
|
|
actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
|
2022-10-11 03:36:18 +00:00
|
|
|
hitscan(pos, sectp, DVector3(ang.ToVector() * vel, zvel * 64), hit, CLIPMASK1);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-11-30 18:49:59 +00:00
|
|
|
if (isRRRA() && hit.hitSector != nullptr && (((hit.hitSector->lotag == ST_160_FLOOR_TELEPORT && zvel > 0) || (hit.hitSector->lotag == ST_161_CEILING_TELEPORT && zvel < 0))
|
2021-11-25 23:08:59 +00:00
|
|
|
&& hit.actor() == nullptr && hit.hitWall == nullptr))
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-11-17 23:01:29 +00:00
|
|
|
DukeStatIterator its(STAT_EFFECTOR);
|
2020-10-24 05:01:01 +00:00
|
|
|
while (auto effector = its.Next())
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-09-13 21:32:38 +00:00
|
|
|
auto Owner = effector->GetOwner();
|
2022-12-01 19:54:41 +00:00
|
|
|
if (effector->sector() == hit.hitSector && iseffector(effector) && Owner && effector->spr.lotag == SE_7_TELEPORT)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-09-12 19:26:17 +00:00
|
|
|
DVector3 npos;
|
2022-09-13 21:32:38 +00:00
|
|
|
npos.XY() = hit.hitpos.XY() + (Owner->spr.pos.XY() - effector->spr.pos.XY());
|
2022-11-30 18:49:59 +00:00
|
|
|
if (hit.hitSector->lotag == ST_161_CEILING_TELEPORT)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-09-13 21:32:38 +00:00
|
|
|
npos.Z = Owner->sector()->floorz;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-09-13 21:32:38 +00:00
|
|
|
npos.Z = Owner->sector()->ceilingz;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2022-09-13 21:32:38 +00:00
|
|
|
hitscan(npos, Owner->sector(), DVector3(ang.ToVector() * 1024, zvel * 0.25), hit, CLIPMASK1);
|
2020-10-20 23:03:38 +00:00
|
|
|
break;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-12-21 19:56:37 +00:00
|
|
|
actor->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitSector == nullptr) return;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith == RTILE_SHOTGUN)
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitSector->lotag == 1)
|
2020-10-20 23:03:38 +00:00
|
|
|
if (krand() & 1)
|
|
|
|
return;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
if ((krand() & 15) == 0 && hit.hitSector->lotag == 2)
|
2022-09-13 21:07:08 +00:00
|
|
|
tracers(hit.hitpos, pos, 8 - (ud.multimode >> 1));
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-24 05:01:01 +00:00
|
|
|
DDukeActor* spark;
|
2020-10-20 23:03:38 +00:00
|
|
|
if (p >= 0)
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
spark = CreateActor(hit.hitSector, hit.hitpos, RTILE_SHOTSPARK1, -15, DVector2(0.15625, 0.15625), ang, 0., 0., actor, 4);
|
2021-11-19 08:47:17 +00:00
|
|
|
if (!spark) return;
|
2021-12-21 17:19:45 +00:00
|
|
|
spark->spr.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
|
|
|
|
spark->spr.extra += (krand() % 6);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitWall == nullptr && hit.actor() == nullptr)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
|
|
|
if (zvel < 0)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-12-18 12:14:56 +00:00
|
|
|
if (hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-10-07 21:52:29 +00:00
|
|
|
spark->spr.scale = DVector2(0, 0);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
else
|
2022-12-05 14:29:45 +00:00
|
|
|
checkhitceiling(hit.hitSector);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitSector->lotag != 1)
|
2022-12-04 13:16:44 +00:00
|
|
|
spawn(spark, RTILE_SMALLSMOKE);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.actor())
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
if (hit.actor()->spr.picnum == RTILE_TORNADO)
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
2021-11-25 23:08:59 +00:00
|
|
|
fi.checkhitsprite(hit.actor(), spark);
|
2021-12-31 17:47:00 +00:00
|
|
|
if (hit.actor()->isPlayer() && (ud.coop != 1 || ud.ffire == 1))
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
auto jib = spawn(spark, RTILE_JIBS6);
|
2022-10-07 21:52:29 +00:00
|
|
|
spark->spr.scale = DVector2(0, 0);
|
2022-09-27 01:45:37 +00:00
|
|
|
if (jib)
|
2021-11-19 11:32:12 +00:00
|
|
|
{
|
2022-09-27 01:45:37 +00:00
|
|
|
jib->spr.pos.Z += 4;
|
|
|
|
jib->vel.X = 1;
|
2022-10-07 21:52:29 +00:00
|
|
|
jib->spr.scale = DVector2(0.375, 0.375);
|
2022-11-25 12:13:50 +00:00
|
|
|
jib->spr.Angles.Yaw += DAngle22_5 / 2 - randomAngle(22.5);
|
2021-11-19 11:32:12 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2022-12-04 13:16:44 +00:00
|
|
|
else spawn(spark, RTILE_SMALLSMOKE);
|
2020-10-20 23:03:38 +00:00
|
|
|
|
2022-12-10 23:23:38 +00:00
|
|
|
if (p >= 0 && isshootableswitch(hit.actor()->spr.spritetexture()))
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-12-11 14:42:33 +00:00
|
|
|
checkhitswitch(p, nullptr, hit.actor());
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2021-11-25 23:08:59 +00:00
|
|
|
else if (hit.hitWall != nullptr)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
spawn(spark, RTILE_SMALLSMOKE);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-12-10 18:03:17 +00:00
|
|
|
if (isadoorwall(hit.hitWall->walltexture) == 1)
|
2020-10-20 23:03:38 +00:00
|
|
|
goto SKIPBULLETHOLE;
|
2022-12-10 18:03:17 +00:00
|
|
|
if (isablockdoor(hit.hitWall->walltexture) == 1)
|
2020-10-20 23:03:38 +00:00
|
|
|
goto SKIPBULLETHOLE;
|
2022-12-10 18:03:17 +00:00
|
|
|
if (p >= 0 && isshootableswitch(hit.hitWall->walltexture))
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-12-11 14:42:33 +00:00
|
|
|
checkhitswitch(p, hit.hitWall, nullptr);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitWall->hitag != 0 || (hit.hitWall->twoSided() && hit.hitWall->nextWall()->hitag != 0))
|
2020-10-20 23:03:38 +00:00
|
|
|
goto SKIPBULLETHOLE;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitSector != nullptr && hit.hitSector->lotag == 0)
|
2022-12-10 18:03:17 +00:00
|
|
|
if (!(tileflags(hit.hitWall->overtexture) & TFLAG_FORCEFIELD))
|
2021-11-25 23:08:59 +00:00
|
|
|
if ((hit.hitWall->twoSided() && hit.hitWall->nextSector()->lotag == 0) ||
|
|
|
|
(!hit.hitWall->twoSided() && hit.hitSector->lotag == 0))
|
2021-12-18 14:11:21 +00:00
|
|
|
if ((hit.hitWall->cstat & CSTAT_WALL_MASKED) == 0)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitWall->twoSided())
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-11-25 23:08:59 +00:00
|
|
|
DukeSectIterator it(hit.hitWall->nextSector());
|
2020-10-24 05:01:01 +00:00
|
|
|
while (auto l = it.Next())
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-01-13 19:53:36 +00:00
|
|
|
if (l->spr.statnum == STAT_EFFECTOR && l->spr.lotag == SE_13_EXPLOSIVE)
|
2020-10-20 23:03:38 +00:00
|
|
|
goto SKIPBULLETHOLE;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-24 05:01:01 +00:00
|
|
|
DukeStatIterator it(STAT_MISC);
|
|
|
|
while (auto l = it.Next())
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
if (l->spr.picnum == RTILE_BULLETHOLE)
|
2022-09-13 18:01:17 +00:00
|
|
|
if ((l->spr.pos - spark->spr.pos).Length() < 0.75 + krandf(0.5))
|
2020-10-20 23:03:38 +00:00
|
|
|
goto SKIPBULLETHOLE;
|
|
|
|
}
|
2022-12-04 13:16:44 +00:00
|
|
|
auto hole = spawn(spark, RTILE_BULLETHOLE);
|
2022-01-13 19:53:36 +00:00
|
|
|
if (hole)
|
2021-11-19 11:32:12 +00:00
|
|
|
{
|
2022-09-11 17:12:47 +00:00
|
|
|
hole->vel.X = -1 / 16;
|
2022-11-25 12:13:50 +00:00
|
|
|
hole->spr.Angles.Yaw = hit.hitWall->delta().Angle() - DAngle90;
|
2022-01-13 19:53:36 +00:00
|
|
|
ssp(hole, CLIPMASK0);
|
|
|
|
hole->spr.cstat2 |= CSTAT2_SPRITE_DECAL;
|
2021-11-19 11:32:12 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
SKIPBULLETHOLE:
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-12-18 14:11:21 +00:00
|
|
|
if (hit.hitWall->cstat & CSTAT_WALL_BOTTOM_SWAP)
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitWall->twoSided())
|
2022-08-28 09:34:54 +00:00
|
|
|
if (hit.hitpos.Z >= hit.hitWall->nextSector()->floorz)
|
2021-11-25 23:08:59 +00:00
|
|
|
hit.hitWall = hit.hitWall->nextWall();
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-12-05 10:27:25 +00:00
|
|
|
checkhitwall(spark, hit.hitWall, hit.hitpos);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
spark = CreateActor(hit.hitSector, hit.hitpos, RTILE_SHOTSPARK1, -15, DVector2(0.375, 0.375), ang, 0., 0., actor, 4);
|
2021-11-19 08:47:17 +00:00
|
|
|
if (!spark) return;
|
2021-12-21 17:19:45 +00:00
|
|
|
spark->spr.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.actor())
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-11-25 23:08:59 +00:00
|
|
|
fi.checkhitsprite(hit.actor(), spark);
|
2021-12-31 17:47:00 +00:00
|
|
|
if (!hit.actor()->isPlayer())
|
2022-12-04 13:16:44 +00:00
|
|
|
spawn(spark, RTILE_SMALLSMOKE);
|
2022-10-07 21:52:29 +00:00
|
|
|
else spark->spr.scale = DVector2(0, 0);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2021-11-25 23:08:59 +00:00
|
|
|
else if (hit.hitWall != nullptr)
|
2022-12-05 10:27:25 +00:00
|
|
|
checkhitwall(spark, hit.hitWall, hit.hitpos);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if ((krand() & 255) < 10)
|
|
|
|
{
|
2022-09-13 17:49:25 +00:00
|
|
|
S_PlaySound3D(PISTOL_RICOCHET, spark, hit.hitpos);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-09-13 21:36:23 +00:00
|
|
|
static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atwith)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sect = actor->sector();
|
2022-09-13 21:36:23 +00:00
|
|
|
double vel = 0, zvel;
|
2021-11-07 13:55:28 +00:00
|
|
|
int scount;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (isRRRA())
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith != RTILE_SHITBALL && actor->spr.extra >= 0) actor->spr.shade = -96;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
scount = 1;
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith == RTILE_SHITBALL)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
if (actor->spr.picnum == RTILE_MAMA)
|
2022-09-13 21:36:23 +00:00
|
|
|
vel = 37.5;
|
2020-10-20 23:03:38 +00:00
|
|
|
else
|
2022-09-13 21:36:23 +00:00
|
|
|
vel = 25;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 19:56:37 +00:00
|
|
|
if (actor->spr.extra >= 0) actor->spr.shade = -96;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
|
|
|
scount = 1;
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith == RTILE_SHITBALL) vel = 25;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith != RTILE_SHITBALL)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-09-13 21:36:23 +00:00
|
|
|
vel = 52.5;
|
|
|
|
pos.Z -= 4;
|
2022-12-04 13:16:44 +00:00
|
|
|
if (actor->spr.picnum == RTILE_HULK)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-11-25 12:13:50 +00:00
|
|
|
pos += (actor->spr.Angles.Yaw + DAngle45).ToVector() * 16;
|
2022-09-13 21:36:23 +00:00
|
|
|
pos.Z += 12;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2022-12-04 13:16:44 +00:00
|
|
|
if (actor->spr.picnum == RTILE_VIXEN)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-09-13 21:36:23 +00:00
|
|
|
pos.Z -= 12;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (p >= 0)
|
|
|
|
{
|
2020-11-01 19:57:02 +00:00
|
|
|
auto aimed = aim(actor, AUTO_AIM_ANGLE);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-11-25 12:13:50 +00:00
|
|
|
pos += (actor->spr.Angles.Yaw + DAngle22_5 * 1.25).ToVector() * 16;
|
2020-11-15 11:07:30 +00:00
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
if (aimed)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-12-06 20:49:04 +00:00
|
|
|
auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture());
|
|
|
|
double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) - 12;
|
2022-09-13 21:36:23 +00:00
|
|
|
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
|
|
|
|
|
|
|
|
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
|
2022-09-30 11:38:21 +00:00
|
|
|
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-11-25 11:24:32 +00:00
|
|
|
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 49.);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-13 21:36:23 +00:00
|
|
|
double x;
|
2020-11-02 22:10:19 +00:00
|
|
|
int j = findplayer(actor, &x);
|
2022-12-04 13:16:44 +00:00
|
|
|
if (actor->spr.picnum == RTILE_HULK)
|
2022-09-13 21:36:23 +00:00
|
|
|
ang -= randomAngle(22.5 / 4);
|
2022-12-04 13:16:44 +00:00
|
|
|
else if (actor->spr.picnum == RTILE_VIXEN)
|
2022-09-13 21:36:23 +00:00
|
|
|
ang -= randomAngle(22.5 / 8);
|
2022-12-04 13:16:44 +00:00
|
|
|
else if (actor->spr.picnum != RTILE_UFOBEAM)
|
2022-09-13 21:36:23 +00:00
|
|
|
ang += DAngle22_5 / 8. - randomAngle(22.5 / 4);
|
2020-10-20 23:03:38 +00:00
|
|
|
|
2022-09-13 21:36:23 +00:00
|
|
|
double dist = (ps[j].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Length();
|
2022-11-24 08:47:02 +00:00
|
|
|
zvel = ((ps[j].GetActor()->getPrevOffsetZ() - pos.Z + 3) * vel) / dist;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-09-13 21:36:23 +00:00
|
|
|
double oldzvel = zvel;
|
2022-12-04 13:16:44 +00:00
|
|
|
double scale = p >= 0? 0.109375 : atwith == RTILE_VIXENSHOT? 0.125 : 0.28125;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith == RTILE_SHITBALL)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
if (!isRRRA() || actor->spr.picnum != RTILE_MAMA) pos.Z -= 10; else pos.Z -= 20;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
while (scount > 0)
|
|
|
|
{
|
2022-10-07 16:51:29 +00:00
|
|
|
auto spawned = CreateActor(sect, pos, atwith, -127, DVector2(scale, scale), ang, vel, zvel, actor, 4);
|
2022-09-13 21:36:23 +00:00
|
|
|
if (!spawned) return;
|
|
|
|
spawned->spr.extra += (krand() & 7);
|
|
|
|
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
2022-10-04 17:08:29 +00:00
|
|
|
spawned->clipdist = 1;
|
2020-10-20 23:03:38 +00:00
|
|
|
|
2022-11-25 12:13:50 +00:00
|
|
|
ang = actor->spr.Angles.Yaw + DAngle22_5 / 4 + randomAngle(22.5 / 2);
|
2022-09-13 21:36:23 +00:00
|
|
|
zvel = oldzvel + 2 - krandf(4);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith == RTILE_FIRELASER)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-10-07 21:52:29 +00:00
|
|
|
spawned->spr.scale = DVector2(0.125, 0.125);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
scount--;
|
|
|
|
}
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-09-13 21:42:09 +00:00
|
|
|
static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atwith)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sect = actor->sector();
|
2022-09-13 21:42:09 +00:00
|
|
|
double vel, zvel;
|
|
|
|
int scount;
|
2020-10-20 23:03:38 +00:00
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
DDukeActor* act90 = nullptr;
|
2021-12-21 19:56:37 +00:00
|
|
|
if (actor->spr.extra >= 0) actor->spr.shade = -96;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
scount = 1;
|
2022-09-13 21:42:09 +00:00
|
|
|
vel = 40.25;
|
2020-10-20 23:03:38 +00:00
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
DDukeActor* aimed = nullptr;
|
2020-10-20 23:03:38 +00:00
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
2022-09-14 15:35:44 +00:00
|
|
|
aimed = aim(actor, AUTO_AIM_ANGLE);
|
2020-11-01 19:57:02 +00:00
|
|
|
if (aimed)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
if (isRRRA() && atwith == RTILE_RPG2)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-12-12 16:51:02 +00:00
|
|
|
if (aimed->IsKindOf(NAME_RedneckHen))
|
2020-11-01 19:57:02 +00:00
|
|
|
act90 = ps[screenpeek].GetActor();
|
2020-05-16 21:55:21 +00:00
|
|
|
else
|
2020-11-01 19:57:02 +00:00
|
|
|
act90 = aimed;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2022-12-06 20:49:04 +00:00
|
|
|
auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture());
|
|
|
|
double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) + 8;
|
2022-09-13 21:42:09 +00:00
|
|
|
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
|
|
|
|
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
|
2022-11-28 09:32:55 +00:00
|
|
|
if (!actorflag(aimed, SFLAG2_SPECIALAUTOAIM))
|
2022-09-30 11:38:21 +00:00
|
|
|
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2022-09-13 21:42:09 +00:00
|
|
|
else
|
2022-11-25 11:24:32 +00:00
|
|
|
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 40.5);
|
2022-09-13 21:42:09 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-13 21:42:09 +00:00
|
|
|
double x;
|
2020-11-02 22:10:19 +00:00
|
|
|
int j = findplayer(actor, &x);
|
2022-11-20 09:00:26 +00:00
|
|
|
ang = (ps[j].GetActor()->opos.XY() - pos.XY()).Angle();
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-09-13 21:42:09 +00:00
|
|
|
double dist = (ps[j].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Length();
|
2022-11-24 08:47:02 +00:00
|
|
|
zvel = ((ps[j].GetActor()->getPrevOffsetZ() - pos.Z) * vel) / dist;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-12-21 19:56:37 +00:00
|
|
|
if (badguy(actor) && (actor->spr.hitag & face_player_smart))
|
2022-11-25 12:13:50 +00:00
|
|
|
ang = actor->spr.Angles.Yaw + randomAngle(22.5 / 4) - DAngle22_5 / 8;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
if (p < 0) aimed = nullptr;
|
2020-10-20 23:03:38 +00:00
|
|
|
|
2022-09-13 21:42:09 +00:00
|
|
|
auto offset = (ang + DAngle1 * 61).ToVector() * (1024 / 448.);
|
2022-10-07 16:51:29 +00:00
|
|
|
auto spawned = CreateActor(sect, pos.plusZ(-1) + offset, atwith, 0, DVector2(0.21875, 0.21875), ang, vel, zvel, actor, 4);
|
2020-10-20 23:03:38 +00:00
|
|
|
|
2021-11-19 08:47:17 +00:00
|
|
|
if (!spawned) return;
|
2023-01-04 19:20:10 +00:00
|
|
|
CallInitialize(spawned);
|
2022-11-29 19:55:02 +00:00
|
|
|
|
|
|
|
if (p >= 0)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-11-29 19:55:02 +00:00
|
|
|
int snd = spawned->IntVar(NAME_spawnsound);
|
|
|
|
if (snd > 0) S_PlayActorSound(FSoundID::fromInt(snd), actor);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-11-29 19:55:02 +00:00
|
|
|
spawned->seek_actor = act90;
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.extra += (krand() & 7);
|
2022-11-23 14:20:54 +00:00
|
|
|
if (!(actorflag(spawned, SFLAG2_REFLECTIVE)))
|
2020-11-01 19:57:02 +00:00
|
|
|
spawned->temp_actor = aimed;
|
2020-10-20 23:03:38 +00:00
|
|
|
else
|
|
|
|
{
|
2022-09-01 16:15:52 +00:00
|
|
|
spawned->spr.yint = gs.numfreezebounces;
|
2022-10-07 21:41:15 +00:00
|
|
|
spawned->spr.scale *= 0.5;
|
2022-09-11 17:28:45 +00:00
|
|
|
spawned->vel.Z -= 0.125;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (p == -1)
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
if (actor->spr.picnum == RTILE_HULK)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-10-07 21:52:29 +00:00
|
|
|
spawned->spr.scale = DVector2(0.125, 0.125);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2022-12-04 13:16:44 +00:00
|
|
|
else if (atwith != RTILE_FREEZEBLAST)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-10-07 21:52:29 +00:00
|
|
|
spawned->spr.scale = DVector2(0.46875, 0.46875);
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.extra >>= 2;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else if (ps[p].curr_weapon == TIT_WEAPON)
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.extra >>= 2;
|
2022-11-25 12:13:50 +00:00
|
|
|
spawned->spr.Angles.Yaw += DAngle22_5 / 8 - randomAngle(DAngle22_5 / 4);
|
2022-09-13 18:40:49 +00:00
|
|
|
spawned->vel.Z += 1 - krandf(2);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (ps[p].hbomb_hold_delay)
|
|
|
|
{
|
2022-09-13 21:42:09 +00:00
|
|
|
DVector2 spawnofs(ang.Sin() * (1024. / 644.), ang.Cos() * -(1024. / 644.));
|
|
|
|
spawned->spr.pos += spawnofs;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-09-13 21:42:09 +00:00
|
|
|
DVector2 spawnofs(ang.Sin() * 4, ang.Cos() * -4);
|
|
|
|
spawned->spr.pos += spawnofs;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2022-10-07 21:41:15 +00:00
|
|
|
spawned->spr.scale *= 0.5;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith == RTILE_RPG || (atwith == RTILE_RPG2 && isRRRA()))
|
2022-10-04 17:08:29 +00:00
|
|
|
spawned->clipdist = 1;
|
2020-10-20 23:03:38 +00:00
|
|
|
else
|
2022-10-04 17:08:29 +00:00
|
|
|
spawned->clipdist = 10;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-09-13 21:50:07 +00:00
|
|
|
static void shootwhip(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atwith)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sect = actor->sector();
|
2022-09-13 21:50:07 +00:00
|
|
|
double vel = 0, zvel;
|
2021-11-07 13:36:39 +00:00
|
|
|
int scount;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-12-21 19:56:37 +00:00
|
|
|
if (actor->spr.extra >= 0) actor->spr.shade = -96;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
scount = 1;
|
2022-12-04 13:16:44 +00:00
|
|
|
if (atwith == RTILE_OWHIP)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-09-13 21:50:07 +00:00
|
|
|
vel = 300/16.;
|
|
|
|
pos.Z -= 15;
|
2020-05-16 21:55:21 +00:00
|
|
|
scount = 1;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2022-12-04 13:16:44 +00:00
|
|
|
else if (atwith == RTILE_UWHIP)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-09-13 21:50:07 +00:00
|
|
|
vel = 300/16;
|
|
|
|
pos.Z += 4;
|
2020-10-20 23:03:38 +00:00
|
|
|
scount = 1;
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (p >= 0)
|
|
|
|
{
|
2020-11-01 19:57:02 +00:00
|
|
|
auto aimed = aim(actor, AUTO_AIM_ANGLE);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
if (aimed)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-12-06 20:49:04 +00:00
|
|
|
auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture());
|
|
|
|
double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) - 12;
|
2022-09-13 21:50:07 +00:00
|
|
|
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
|
|
|
|
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
|
2022-09-30 11:38:21 +00:00
|
|
|
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
else
|
2022-11-25 11:24:32 +00:00
|
|
|
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 49.);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-13 21:50:07 +00:00
|
|
|
double x;
|
2020-11-02 22:10:19 +00:00
|
|
|
int j = findplayer(actor, &x);
|
2022-12-04 13:16:44 +00:00
|
|
|
if (actor->spr.picnum == RTILE_VIXEN)
|
2022-09-13 21:50:07 +00:00
|
|
|
ang -= randomAngle(22.5 / 8);
|
2020-10-20 23:03:38 +00:00
|
|
|
else
|
2022-09-13 21:50:07 +00:00
|
|
|
ang += DAngle22_5/8 - randomAngle(22.5 / 4);
|
|
|
|
|
|
|
|
double dist = (ps[j].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Length();
|
2022-11-24 08:47:02 +00:00
|
|
|
zvel = ((ps[j].GetActor()->getPrevOffsetZ() - pos.Z + 3) * vel) / dist;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-09-13 21:50:07 +00:00
|
|
|
double oldzvel = zvel;
|
2022-10-07 16:51:29 +00:00
|
|
|
double scale = p >= 0? 0.109375 : 0.125;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
while (scount > 0)
|
|
|
|
{
|
2022-10-07 16:51:29 +00:00
|
|
|
auto spawned = CreateActor(sect, pos, atwith, -127, DVector2(scale,scale), ang, vel, zvel, actor, 4);
|
2022-09-13 21:50:07 +00:00
|
|
|
if (!spawned) return;
|
|
|
|
spawned->spr.extra += (krand() & 7);
|
|
|
|
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
2022-10-04 17:08:29 +00:00
|
|
|
spawned->clipdist = 1;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-11-25 12:13:50 +00:00
|
|
|
ang = actor->spr.Angles.Yaw + DAngle22_5/4 - randomAngle(DAngle22_5/2);
|
2022-09-13 21:50:07 +00:00
|
|
|
zvel = oldzvel + 2 - krandf(4);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
scount--;
|
|
|
|
}
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-13 21:54:04 +00:00
|
|
|
static void shootmortar(DDukeActor* actor, int p, const DVector3& pos, DAngle ang, int atwith)
|
|
|
|
{
|
|
|
|
auto sect = actor->sector();
|
|
|
|
if (actor->spr.extra >= 0) actor->spr.shade = -96;
|
|
|
|
|
|
|
|
double x;
|
|
|
|
auto plActor = ps[findplayer(actor, &x)].GetActor();
|
|
|
|
x = (plActor->spr.pos.XY() - actor->spr.pos.XY()).Length();
|
|
|
|
|
|
|
|
double zvel = -x * 0.5;
|
|
|
|
|
|
|
|
if (zvel < -8)
|
|
|
|
zvel = -4;
|
|
|
|
double vel = x / 16.;
|
2022-12-04 13:16:44 +00:00
|
|
|
double size = atwith == RTILE_CHEERBOMB ? 0.25 : 0.5;
|
2022-09-13 21:54:04 +00:00
|
|
|
|
2022-10-07 16:51:29 +00:00
|
|
|
CreateActor(sect, pos.plusZ(-6) + ang.ToVector() * 4, atwith, -64, DVector2(size, size), ang, vel, zvel, actor, 1);
|
2022-09-13 21:54:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-11-29 12:06:42 +00:00
|
|
|
void shoot_r(DDukeActor* actor, int atwith, PClass* cls)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-09-13 22:02:49 +00:00
|
|
|
int p;
|
|
|
|
DVector3 spos;
|
|
|
|
DAngle sang;
|
2020-11-01 17:23:09 +00:00
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
auto const sect = actor->sector();
|
2020-10-20 23:03:38 +00:00
|
|
|
|
2022-11-29 12:06:42 +00:00
|
|
|
sang = actor->spr.Angles.Yaw;
|
2021-12-31 17:47:00 +00:00
|
|
|
if (actor->isPlayer())
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-09-01 15:26:46 +00:00
|
|
|
p = actor->PlayerIndex();
|
2022-11-29 12:06:42 +00:00
|
|
|
spos = actor->getPosWithOffsetZ().plusZ(ps[p].pyoff + 4);
|
2020-10-20 23:03:38 +00:00
|
|
|
|
|
|
|
if (isRRRA()) ps[p].crack_time = CRACK_TIME;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p = -1;
|
2022-12-06 20:49:04 +00:00
|
|
|
auto tex = TexMan.GetGameTexture(actor->spr.spritetexture());
|
|
|
|
spos = actor->spr.pos.plusZ(-(actor->spr.scale.Y * tex->GetDisplayHeight() * 0.5) - 3);
|
2022-09-13 22:02:49 +00:00
|
|
|
|
2021-12-21 19:56:37 +00:00
|
|
|
if (badguy(actor))
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2022-09-13 22:02:49 +00:00
|
|
|
spos.X -= (sang + DAngle22_5 * 0.75).Sin() * 8;
|
|
|
|
spos.Y += (sang + DAngle22_5 * 0.75).Cos() * 8;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2022-09-13 18:35:14 +00:00
|
|
|
|
2022-11-29 12:06:42 +00:00
|
|
|
if (cls == nullptr)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2022-11-29 12:06:42 +00:00
|
|
|
auto info = spawnMap.CheckKey(atwith);
|
|
|
|
if (info)
|
|
|
|
{
|
|
|
|
cls = static_cast<PClassActor*>(info->Class(atwith));
|
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2022-11-29 12:06:42 +00:00
|
|
|
if (cls && cls->IsDescendantOf(RUNTIME_CLASS(DDukeActor)) && CallShootThis(static_cast<DDukeActor*>(GetDefaultByType(cls)), actor, p, spos, sang)) return;
|
2022-12-17 23:34:17 +00:00
|
|
|
if (cls && atwith == -1) atwith = GetDefaultByType(cls)->spr.picnum;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
switch (atwith)
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_SLINGBLADE:
|
2020-10-20 23:03:38 +00:00
|
|
|
if (!isRRRA()) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_KNEE:
|
|
|
|
case RTILE_GROWSPARK:
|
2022-09-13 21:00:32 +00:00
|
|
|
shootmelee(actor, p, spos, sang, atwith);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_SHOTSPARK1:
|
|
|
|
case RTILE_SHOTGUN:
|
|
|
|
case RTILE_CHAINGUN:
|
2022-09-27 01:45:37 +00:00
|
|
|
shootweapon(actor, p, spos, sang, atwith);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_OWHIP:
|
|
|
|
case RTILE_UWHIP:
|
2022-09-13 21:50:07 +00:00
|
|
|
shootwhip(actor, p, spos, sang, atwith);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_FIRELASER:
|
|
|
|
case RTILE_SHITBALL:
|
|
|
|
case RTILE_VIXENSHOT:
|
2022-09-13 21:36:23 +00:00
|
|
|
shootstuff(actor, p, spos, sang, atwith);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_RPG2:
|
|
|
|
case RTILE_BOATGRENADE:
|
2020-10-20 23:03:38 +00:00
|
|
|
if (isRRRA()) goto rrra_rpg2;
|
|
|
|
else break;
|
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_RPG:
|
|
|
|
case RTILE_SAWBLADE:
|
2020-10-20 23:03:38 +00:00
|
|
|
rrra_rpg2:
|
2022-09-13 21:42:09 +00:00
|
|
|
shootrpg(actor, p, spos, sang, atwith);
|
2020-10-20 23:03:38 +00:00
|
|
|
break;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_CHEERBOMB:
|
2020-05-16 21:55:21 +00:00
|
|
|
if (!isRRRA()) break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_MORTER:
|
2022-09-13 21:54:04 +00:00
|
|
|
shootmortar(actor, p, spos, sang, atwith);
|
2020-05-16 21:55:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-17 11:25:39 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// this is one lousy hack job...
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-26 22:53:35 +00:00
|
|
|
void selectweapon_r(int snum, int weap)
|
2020-05-17 11:25:39 +00:00
|
|
|
{
|
2020-08-26 22:53:35 +00:00
|
|
|
int i, j, k;
|
2020-05-17 11:25:39 +00:00
|
|
|
auto p = &ps[snum];
|
2022-10-07 21:33:37 +00:00
|
|
|
if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->spr.scale.X > 0.125 && p->access_incs == 0 && p->knee_incs == 0)
|
2020-05-17 11:25:39 +00:00
|
|
|
{
|
|
|
|
if ((p->weapon_pos == 0 || (p->holster_weapon && p->weapon_pos == -9)))
|
|
|
|
{
|
2020-08-26 22:53:35 +00:00
|
|
|
if (weap == WeaponSel_Alt)
|
|
|
|
{
|
2020-12-01 20:07:38 +00:00
|
|
|
j = p->curr_weapon;
|
2020-08-29 11:27:58 +00:00
|
|
|
switch (p->curr_weapon)
|
|
|
|
{
|
|
|
|
case THROWSAW_WEAPON:
|
2020-12-01 20:07:38 +00:00
|
|
|
if (p->ammo_amount[BUZZSAW_WEAPON] > 0)
|
|
|
|
{
|
|
|
|
j = BUZZSAW_WEAPON;
|
|
|
|
p->subweapon = 1 << BUZZSAW_WEAPON;
|
|
|
|
}
|
2020-08-29 11:27:58 +00:00
|
|
|
break;
|
|
|
|
case BUZZSAW_WEAPON:
|
2020-12-01 20:07:38 +00:00
|
|
|
if (p->ammo_amount[THROWSAW_WEAPON] > 0)
|
|
|
|
{
|
|
|
|
j = THROWSAW_WEAPON;
|
|
|
|
p->subweapon = 0;
|
|
|
|
}
|
2020-08-29 11:27:58 +00:00
|
|
|
break;
|
|
|
|
case POWDERKEG_WEAPON:
|
2020-12-01 20:07:38 +00:00
|
|
|
if (p->ammo_amount[BOWLING_WEAPON] > 0)
|
|
|
|
{
|
|
|
|
j = BOWLING_WEAPON;
|
|
|
|
p->subweapon = 1 << BOWLING_WEAPON;
|
|
|
|
}
|
2020-08-29 11:27:58 +00:00
|
|
|
break;
|
|
|
|
case BOWLING_WEAPON:
|
2020-12-01 20:07:38 +00:00
|
|
|
if (p->ammo_amount[POWDERKEG_WEAPON] > 0)
|
|
|
|
{
|
|
|
|
j = POWDERKEG_WEAPON;
|
|
|
|
p->subweapon = 0;
|
|
|
|
}
|
2020-08-29 11:27:58 +00:00
|
|
|
break;
|
|
|
|
case KNEE_WEAPON:
|
2020-12-01 20:07:38 +00:00
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
j = SLINGBLADE_WEAPON;
|
|
|
|
p->subweapon = 2;
|
|
|
|
}
|
2020-08-29 11:27:58 +00:00
|
|
|
break;
|
|
|
|
case SLINGBLADE_WEAPON:
|
|
|
|
j = KNEE_WEAPON;
|
2020-12-01 20:07:38 +00:00
|
|
|
p->subweapon = 0;
|
2020-08-29 11:27:58 +00:00
|
|
|
break;
|
2021-06-24 08:56:12 +00:00
|
|
|
case CROSSBOW_WEAPON:
|
2020-12-01 20:07:38 +00:00
|
|
|
if (p->ammo_amount[CHICKEN_WEAPON] > 0 && isRRRA())
|
|
|
|
{
|
|
|
|
j = CHICKEN_WEAPON;
|
|
|
|
p->subweapon = 4;
|
|
|
|
}
|
2020-08-29 11:27:58 +00:00
|
|
|
break;
|
|
|
|
case CHICKEN_WEAPON:
|
2021-06-24 08:56:12 +00:00
|
|
|
if (p->ammo_amount[CROSSBOW_WEAPON] > 0)
|
2020-12-01 20:07:38 +00:00
|
|
|
{
|
2021-06-24 08:56:12 +00:00
|
|
|
j = CROSSBOW_WEAPON;
|
2020-12-01 20:07:38 +00:00
|
|
|
p->subweapon = 0;
|
|
|
|
}
|
2020-08-29 11:27:58 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2020-08-26 22:53:35 +00:00
|
|
|
}
|
|
|
|
else if (weap == WeaponSel_Next || weap == WeaponSel_Prev)
|
2020-05-17 11:25:39 +00:00
|
|
|
{
|
|
|
|
k = p->curr_weapon;
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (k == CHICKEN_WEAPON) k = CROSSBOW_WEAPON;
|
|
|
|
else if (k == BUZZSAW_WEAPON) k = THROWSAW_WEAPON;
|
|
|
|
else if (k == SLINGBLADE_WEAPON) k = KNEE_WEAPON;
|
|
|
|
}
|
2020-08-26 22:53:35 +00:00
|
|
|
j = (weap == WeaponSel_Prev ? -1 : 1); // JBF: prev (-1) or next (1) weapon choice
|
2020-05-17 11:25:39 +00:00
|
|
|
i = 0;
|
|
|
|
|
|
|
|
while (k >= 0 && k < 10)
|
|
|
|
{
|
|
|
|
k += j;
|
|
|
|
if (k == -1) k = 9;
|
|
|
|
else if (k == 10) k = 0;
|
|
|
|
|
|
|
|
if (p->gotweapon[k] && p->ammo_amount[k] > 0)
|
|
|
|
{
|
|
|
|
j = k;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
if (i == 10)
|
|
|
|
{
|
2022-11-12 08:33:33 +00:00
|
|
|
fi.addweapon(p, KNEE_WEAPON, true);
|
2020-05-17 11:25:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-17 12:42:58 +00:00
|
|
|
else j = weap - 1;
|
2020-05-17 11:25:39 +00:00
|
|
|
|
|
|
|
k = -1;
|
|
|
|
|
|
|
|
if (j == DYNAMITE_WEAPON && p->ammo_amount[DYNAMITE_WEAPON] == 0)
|
|
|
|
{
|
2020-10-25 05:34:25 +00:00
|
|
|
DukeStatIterator it(STAT_ACTOR);
|
|
|
|
while (auto act = it.Next())
|
2020-05-17 11:25:39 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
if (act->spr.picnum == RTILE_DYNAMITE && act->GetOwner() == p->GetActor())
|
2020-05-17 11:25:39 +00:00
|
|
|
{
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[DYNAMITE_WEAPON] = true;
|
2020-05-20 08:38:56 +00:00
|
|
|
j = THROWINGDYNAMITE_WEAPON;
|
2020-05-17 11:25:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (j == KNEE_WEAPON && isRRRA())
|
|
|
|
{
|
|
|
|
if (p->curr_weapon == KNEE_WEAPON)
|
|
|
|
{
|
|
|
|
p->subweapon = 2;
|
|
|
|
j = SLINGBLADE_WEAPON;
|
|
|
|
}
|
|
|
|
else if (p->subweapon & 2)
|
|
|
|
{
|
|
|
|
p->subweapon = 0;
|
|
|
|
j = KNEE_WEAPON;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (j == CROSSBOW_WEAPON && isRRRA())
|
|
|
|
{
|
|
|
|
if (p->curr_weapon == CROSSBOW_WEAPON || p->ammo_amount[CROSSBOW_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
if (p->ammo_amount[CHICKEN_WEAPON] == 0)
|
|
|
|
return;
|
|
|
|
p->subweapon = 4;
|
|
|
|
j = CHICKEN_WEAPON;
|
|
|
|
}
|
|
|
|
else if ((p->subweapon & 4) || p->ammo_amount[CHICKEN_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
p->subweapon = 0;
|
|
|
|
j = CROSSBOW_WEAPON;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (j == THROWSAW_WEAPON)
|
|
|
|
{
|
|
|
|
if (p->curr_weapon == THROWSAW_WEAPON || p->ammo_amount[THROWSAW_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
p->subweapon = (1 << BUZZSAW_WEAPON);
|
|
|
|
j = BUZZSAW_WEAPON;
|
|
|
|
}
|
|
|
|
else if ((p->subweapon & (1 << BUZZSAW_WEAPON)) || p->ammo_amount[BUZZSAW_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
p->subweapon = 0;
|
|
|
|
j = THROWSAW_WEAPON;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (j == POWDERKEG_WEAPON)
|
|
|
|
{
|
|
|
|
if (p->curr_weapon == POWDERKEG_WEAPON || p->ammo_amount[POWDERKEG_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
p->subweapon = (1 << BOWLING_WEAPON);
|
|
|
|
j = BOWLING_WEAPON;
|
|
|
|
}
|
|
|
|
else if ((p->subweapon & (1 << BOWLING_WEAPON)) || p->ammo_amount[BOWLING_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
p->subweapon = 0;
|
|
|
|
j = POWDERKEG_WEAPON;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (p->holster_weapon)
|
|
|
|
{
|
2020-08-27 22:03:35 +00:00
|
|
|
PlayerSetInput(snum, SB_HOLSTER);
|
2020-09-16 11:01:09 +00:00
|
|
|
p->oweapon_pos = p->weapon_pos = -9;
|
2020-05-17 11:25:39 +00:00
|
|
|
}
|
|
|
|
else if (j >= MIN_WEAPON && p->gotweapon[j] && p->curr_weapon != j) switch (j)
|
|
|
|
{
|
|
|
|
case KNEE_WEAPON:
|
2022-11-12 08:33:33 +00:00
|
|
|
fi.addweapon(p, j, true);
|
2020-05-17 11:25:39 +00:00
|
|
|
break;
|
|
|
|
case SLINGBLADE_WEAPON:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(496, ps[screenpeek].GetActor());
|
2022-11-12 08:33:33 +00:00
|
|
|
fi.addweapon(p, j, true);
|
2020-05-17 11:25:39 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PISTOL_WEAPON:
|
|
|
|
if (p->ammo_amount[PISTOL_WEAPON] == 0)
|
|
|
|
if (p->show_empty_weapon == 0)
|
|
|
|
{
|
|
|
|
p->last_full_weapon = p->curr_weapon;
|
|
|
|
p->show_empty_weapon = 32;
|
|
|
|
}
|
2022-11-12 08:33:33 +00:00
|
|
|
fi.addweapon(p, PISTOL_WEAPON, true);
|
2020-05-17 11:25:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CHICKEN_WEAPON:
|
|
|
|
if (!isRRRA()) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-17 11:25:39 +00:00
|
|
|
case SHOTGUN_WEAPON:
|
|
|
|
case RIFLEGUN_WEAPON:
|
|
|
|
case CROSSBOW_WEAPON:
|
|
|
|
case TIT_WEAPON:
|
|
|
|
case ALIENBLASTER_WEAPON:
|
|
|
|
case THROWSAW_WEAPON:
|
|
|
|
case BUZZSAW_WEAPON:
|
|
|
|
case POWDERKEG_WEAPON:
|
|
|
|
case BOWLING_WEAPON:
|
|
|
|
if (p->ammo_amount[j] == 0 && p->show_empty_weapon == 0)
|
|
|
|
{
|
|
|
|
p->last_full_weapon = p->curr_weapon;
|
|
|
|
p->show_empty_weapon = 32;
|
|
|
|
}
|
2022-11-12 08:33:33 +00:00
|
|
|
fi.addweapon(p, j, true);
|
2020-05-17 11:25:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MOTORCYCLE_WEAPON:
|
|
|
|
case BOAT_WEAPON:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (p->ammo_amount[j] == 0 && p->show_empty_weapon == 0)
|
|
|
|
{
|
|
|
|
p->show_empty_weapon = 32;
|
|
|
|
}
|
2022-11-12 08:33:33 +00:00
|
|
|
fi.addweapon(p, j, true);
|
2020-05-17 11:25:39 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-05-20 08:38:56 +00:00
|
|
|
case THROWINGDYNAMITE_WEAPON:
|
2020-05-17 11:25:39 +00:00
|
|
|
if (k >= 0) // Found in list of [1]'s
|
|
|
|
{
|
2020-05-20 08:38:56 +00:00
|
|
|
p->curr_weapon = THROWINGDYNAMITE_WEAPON;
|
2020-05-17 11:25:39 +00:00
|
|
|
p->last_weapon = -1;
|
2020-09-16 11:01:09 +00:00
|
|
|
p->oweapon_pos = p->weapon_pos = 10;
|
2020-05-17 11:25:39 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DYNAMITE_WEAPON:
|
|
|
|
if (p->ammo_amount[DYNAMITE_WEAPON] > 0 && p->gotweapon[DYNAMITE_WEAPON])
|
2022-11-12 08:33:33 +00:00
|
|
|
fi.addweapon(p, DYNAMITE_WEAPON, true);
|
2020-05-17 11:25:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-05-17 16:04:45 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-02-07 10:04:19 +00:00
|
|
|
int doincrements_r(player_struct* p)
|
2020-05-17 16:04:45 +00:00
|
|
|
{
|
|
|
|
int snum;
|
2020-11-02 19:24:07 +00:00
|
|
|
auto pact = p->GetActor();
|
2020-05-17 16:04:45 +00:00
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (WindTime > 0)
|
|
|
|
WindTime--;
|
|
|
|
else if ((krand() & 127) == 8)
|
|
|
|
{
|
|
|
|
WindTime = 120 + ((krand() & 63) << 2);
|
2022-09-11 20:57:56 +00:00
|
|
|
WindDir = randomAngle();
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (chickenphase > 0)
|
|
|
|
chickenphase--;
|
|
|
|
if (p->SeaSick)
|
|
|
|
{
|
|
|
|
p->SeaSick--;
|
|
|
|
if (p->SeaSick == 0)
|
|
|
|
p->sea_sick_stat = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-01 15:26:46 +00:00
|
|
|
snum = p->GetActor()->PlayerIndex();
|
2020-05-17 16:04:45 +00:00
|
|
|
|
|
|
|
p->player_par++;
|
|
|
|
if (p->yehaa_timer)
|
|
|
|
p->yehaa_timer--;
|
|
|
|
|
|
|
|
|
|
|
|
if (p->detonate_count > 0)
|
|
|
|
{
|
|
|
|
p->detonate_count++;
|
|
|
|
p->detonate_time--;
|
|
|
|
}
|
|
|
|
p->drink_timer--;
|
|
|
|
if (p->drink_timer <= 0)
|
|
|
|
{
|
|
|
|
p->drink_timer = 1024;
|
|
|
|
if (p->drink_amt)
|
|
|
|
{
|
|
|
|
p->drink_amt--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p->eat_timer--;
|
|
|
|
if (p->eat_timer <= 0)
|
|
|
|
{
|
|
|
|
p->eat_timer = 1024;
|
|
|
|
if (p->eat)
|
|
|
|
p->eat--;
|
|
|
|
}
|
|
|
|
if (p->drink_amt >= 100)
|
|
|
|
{
|
2020-11-02 19:24:07 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, 420))
|
|
|
|
S_PlayActorSound(420, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
p->drink_amt -= 9;
|
|
|
|
p->eat >>= 1;
|
|
|
|
}
|
|
|
|
p->eatang = (1647 + p->eat * 8) & 2047;
|
|
|
|
|
|
|
|
if (p->eat >= 100)
|
|
|
|
p->eat = 100;
|
|
|
|
|
|
|
|
if (p->eat >= 31 && krand() < p->eat)
|
|
|
|
{
|
|
|
|
switch (krand() & 3)
|
|
|
|
{
|
|
|
|
case 0:
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(404, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(422, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(423, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(424, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (numplayers < 2)
|
|
|
|
{
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 1024;
|
2020-05-17 16:04:45 +00:00
|
|
|
madenoise(screenpeek);
|
2022-11-25 11:30:40 +00:00
|
|
|
p->vel.XY() += p->GetActor()->spr.Angles.Yaw.ToVector();
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
|
|
|
p->eat -= 4;
|
|
|
|
if (p->eat < 0)
|
|
|
|
p->eat = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->invdisptime > 0)
|
|
|
|
p->invdisptime--;
|
|
|
|
|
2022-06-05 23:40:47 +00:00
|
|
|
if (p->tipincs > 0)
|
|
|
|
{
|
|
|
|
p->otipincs = p->tipincs;
|
|
|
|
p->tipincs--;
|
|
|
|
}
|
2020-05-17 16:04:45 +00:00
|
|
|
|
|
|
|
if (p->last_pissed_time > 0)
|
|
|
|
{
|
|
|
|
p->last_pissed_time--;
|
|
|
|
|
|
|
|
if (p->drink_amt > 66 && (p->last_pissed_time % 26) == 0)
|
|
|
|
p->drink_amt--;
|
|
|
|
|
|
|
|
{
|
|
|
|
if (p->last_pissed_time == 5662)
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(434, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
else if (p->last_pissed_time == 5567)
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(434, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
else if (p->last_pissed_time == 5472)
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(433, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
else if (p->last_pissed_time == 5072)
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(435, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
else if (p->last_pissed_time == 5014)
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(434, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
else if (p->last_pissed_time == 4919)
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(433, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (p->last_pissed_time == 5668)
|
|
|
|
{
|
|
|
|
p->holster_weapon = 0;
|
2020-09-16 11:01:09 +00:00
|
|
|
p->oweapon_pos = p->weapon_pos = 10;
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->crack_time > 0)
|
|
|
|
{
|
|
|
|
p->crack_time--;
|
|
|
|
if (p->crack_time == 0)
|
|
|
|
{
|
|
|
|
p->knuckle_incs = 1;
|
2020-08-27 05:54:49 +00:00
|
|
|
p->crack_time = CRACK_TIME;
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->steroids_amount > 0 && p->steroids_amount < 400)
|
|
|
|
{
|
|
|
|
p->steroids_amount--;
|
|
|
|
if (p->steroids_amount == 0)
|
|
|
|
{
|
|
|
|
checkavailinven(p);
|
|
|
|
p->eat = p->drink_amt = 0;
|
|
|
|
p->eatang = p->drunkang = 1647;
|
|
|
|
}
|
|
|
|
if (!(p->steroids_amount & 14))
|
|
|
|
if (snum == screenpeek || ud.coop == 1)
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(DUKE_TAKEPILLS, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (p->access_incs && p->GetActor()->spr.pal != 1)
|
2020-05-17 16:04:45 +00:00
|
|
|
{
|
2022-06-05 23:47:30 +00:00
|
|
|
p->oaccess_incs = p->access_incs;
|
2020-05-17 16:04:45 +00:00
|
|
|
p->access_incs++;
|
2021-12-21 17:19:45 +00:00
|
|
|
if (p->GetActor()->spr.extra <= 0)
|
2020-05-17 16:04:45 +00:00
|
|
|
p->access_incs = 12;
|
|
|
|
if (p->access_incs == 12)
|
|
|
|
{
|
2020-10-25 05:34:25 +00:00
|
|
|
if (p->access_spritenum != nullptr)
|
2020-05-17 16:04:45 +00:00
|
|
|
{
|
2022-12-11 14:42:33 +00:00
|
|
|
checkhitswitch(snum, nullptr, p->access_spritenum);
|
2021-12-21 17:19:45 +00:00
|
|
|
switch (p->access_spritenum->spr.pal)
|
2020-05-17 16:04:45 +00:00
|
|
|
{
|
|
|
|
case 0:p->keys[1] = 1; break;
|
|
|
|
case 21:p->keys[2] = 1; break;
|
|
|
|
case 23:p->keys[3] = 1; break;
|
|
|
|
}
|
2020-10-25 05:34:25 +00:00
|
|
|
p->access_spritenum = nullptr;
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-12-11 14:42:33 +00:00
|
|
|
checkhitswitch(snum, p->access_wall, nullptr);
|
2021-11-17 23:20:39 +00:00
|
|
|
switch (p->access_wall->pal)
|
2020-05-17 16:04:45 +00:00
|
|
|
{
|
|
|
|
case 0:p->keys[1] = 1; break;
|
|
|
|
case 21:p->keys[2] = 1; break;
|
|
|
|
case 23:p->keys[3] = 1; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->access_incs > 20)
|
|
|
|
{
|
2022-06-05 23:47:30 +00:00
|
|
|
p->oaccess_incs = p->access_incs = 0;
|
2020-09-16 11:01:09 +00:00
|
|
|
p->oweapon_pos = p->weapon_pos = 10;
|
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-21 07:56:39 +00:00
|
|
|
if (p->scuba_on == 0 && p->insector() && p->cursector->lotag == 2)
|
2020-05-17 16:04:45 +00:00
|
|
|
{
|
|
|
|
if (p->scuba_amount > 0)
|
|
|
|
{
|
|
|
|
p->scuba_on = 1;
|
|
|
|
p->inven_icon = 6;
|
|
|
|
FTA(76, p);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p->airleft > 0)
|
|
|
|
p->airleft--;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->extra_extra8 += 32;
|
2020-11-29 12:54:58 +00:00
|
|
|
if (p->last_extra < (gs.max_player_health >> 1) && (p->last_extra & 3) == 0)
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(DUKE_LONGTERM_PAIN, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->scuba_amount > 0 && p->scuba_on)
|
|
|
|
{
|
|
|
|
p->scuba_amount--;
|
|
|
|
if (p->scuba_amount == 0)
|
|
|
|
{
|
|
|
|
p->scuba_on = 0;
|
|
|
|
checkavailinven(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->knuckle_incs)
|
|
|
|
{
|
|
|
|
p->knuckle_incs++;
|
|
|
|
if (p->knuckle_incs == 10)
|
|
|
|
{
|
|
|
|
if (!wupass)
|
|
|
|
{
|
2021-05-02 11:12:24 +00:00
|
|
|
int snd = currentLevel->rr_startsound ? currentLevel->rr_startsound : 391;
|
2020-05-17 16:04:45 +00:00
|
|
|
wupass = 1;
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(snd, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
2021-02-18 10:46:36 +00:00
|
|
|
else if (PlayClock > 1024)
|
2020-05-17 16:04:45 +00:00
|
|
|
if (snum == screenpeek || ud.coop == 1)
|
|
|
|
{
|
|
|
|
if (rand() & 1)
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(DUKE_CRACK, pact);
|
|
|
|
else S_PlayActorSound(DUKE_CRACK2, pact);
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-28 20:51:05 +00:00
|
|
|
else if (p->knuckle_incs == 22 || PlayerInput(snum, SB_FIRE))
|
2020-05-17 16:04:45 +00:00
|
|
|
p->knuckle_incs = 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-02-07 10:04:19 +00:00
|
|
|
void checkweapons_r(player_struct* p)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
static const uint16_t weapon_sprites[MAX_WEAPONS] = { RTILE_KNEE, RTILE_FIRSTGUNSPRITE, RTILE_SHOTGUNSPRITE,
|
|
|
|
RTILE_RIFLEGUNSPRITE, RTILE_DYNAMITE, RTILE_CROSSBOWSPRITE, RTILE_RIPSAWSPRITE, RTILE_ALIENBLASTERSPRITE,
|
|
|
|
RTILE_POWDERKEG, RTILE_BOWLINGBALLSPRITE, RTILE_TITSPRITE, RTILE_DYNAMITE };
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (p->OnMotorcycle && numplayers > 1)
|
|
|
|
{
|
2020-10-25 06:30:47 +00:00
|
|
|
auto j = spawn(p->GetActor(), 7220);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (j)
|
|
|
|
{
|
2022-11-27 00:13:43 +00:00
|
|
|
j->spr.Angles.Yaw = p->GetActor()->spr.Angles.Yaw;
|
2021-11-19 11:32:12 +00:00
|
|
|
j->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON];
|
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
p->OnMotorcycle = 0;
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[MOTORCYCLE_WEAPON] = false;
|
2022-11-25 11:30:40 +00:00
|
|
|
p->GetActor()->spr.Angles.Pitch = nullAngle;
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_do_bump = 0;
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->TiltStatus = 0;
|
|
|
|
p->moto_drink = 0;
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->VBumpNow = 0;
|
|
|
|
p->TurbCount = 0;
|
|
|
|
}
|
|
|
|
else if (p->OnBoat && numplayers > 1)
|
|
|
|
{
|
2020-10-25 06:30:47 +00:00
|
|
|
auto j = spawn(p->GetActor(), 7233);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (j)
|
|
|
|
{
|
2022-11-27 00:13:43 +00:00
|
|
|
j->spr.Angles.Yaw = p->GetActor()->spr.Angles.Yaw;
|
2021-11-19 11:32:12 +00:00
|
|
|
j->saved_ammo = p->ammo_amount[BOAT_WEAPON];
|
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
p->OnBoat = 0;
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[BOAT_WEAPON] = false;
|
2022-11-25 11:30:40 +00:00
|
|
|
p->GetActor()->spr.Angles.Pitch = nullAngle;
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_do_bump = 0;
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->TiltStatus = 0;
|
|
|
|
p->moto_drink = 0;
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->VBumpNow = 0;
|
|
|
|
p->TurbCount = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->curr_weapon > 0)
|
|
|
|
{
|
|
|
|
if (krand() & 1)
|
2020-10-25 06:30:47 +00:00
|
|
|
spawn(p->GetActor(), weapon_sprites[p->curr_weapon]);
|
2020-05-17 21:44:53 +00:00
|
|
|
else switch (p->curr_weapon)
|
|
|
|
{
|
|
|
|
case CHICKEN_WEAPON:
|
|
|
|
if (!isRRRA()) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-17 21:44:53 +00:00
|
|
|
case DYNAMITE_WEAPON:
|
|
|
|
case CROSSBOW_WEAPON:
|
2022-12-04 13:16:44 +00:00
|
|
|
spawn(p->GetActor(), RTILE_EXPLOSION2);
|
2020-05-17 21:44:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-25 06:30:47 +00:00
|
|
|
for (int i = 0; i < 5; i++)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (p->keys[i] == 1)
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
auto j = spawn(p->GetActor(), RTILE_ACCESSCARD);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (j) switch (i)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
case 1:
|
2021-12-21 17:19:45 +00:00
|
|
|
j->spr.lotag = 100;
|
2020-05-17 21:44:53 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-12-21 17:19:45 +00:00
|
|
|
j->spr.lotag = 101;
|
2020-05-17 21:44:53 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-12-21 17:19:45 +00:00
|
|
|
j->spr.lotag = 102;
|
2020-05-17 21:44:53 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2021-12-21 17:19:45 +00:00
|
|
|
j->spr.lotag = 103;
|
2020-05-17 21:44:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2023-03-20 22:39:35 +00:00
|
|
|
enum : unsigned
|
|
|
|
{
|
|
|
|
VEH_FORWARD = 1,
|
|
|
|
VEH_REVERSE = 2,
|
|
|
|
VEH_TURNLEFT = 4,
|
|
|
|
VEH_TURNRIGHT = 8,
|
2023-03-20 23:21:30 +00:00
|
|
|
VEH_TURNING = VEH_TURNLEFT|VEH_TURNRIGHT,
|
2023-03-20 22:39:35 +00:00
|
|
|
VEH_BRAKING = 16,
|
2023-03-20 23:12:30 +00:00
|
|
|
VEH_FWDBRAKING = VEH_FORWARD|VEH_BRAKING,
|
2023-03-20 22:39:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static unsigned outVehicleFlags(player_struct* p, ESyncBits& actions)
|
|
|
|
{
|
|
|
|
unsigned flags = 0;
|
|
|
|
flags += VEH_FORWARD * (p->sync.fvel > 0);
|
|
|
|
flags += VEH_REVERSE * (p->sync.fvel < 0);
|
|
|
|
flags += VEH_TURNLEFT * (p->sync.avel < 0);
|
|
|
|
flags += VEH_TURNRIGHT * (p->sync.avel > 0);
|
|
|
|
flags += VEH_BRAKING * !!(actions & SB_CROUCH);
|
|
|
|
actions &= ~SB_CROUCH;
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2023-03-30 11:42:06 +00:00
|
|
|
static void doVehicleTilting(player_struct* const p, const int turndir, const bool canTilt)
|
|
|
|
{
|
|
|
|
p->oTiltStatus = p->TiltStatus;
|
|
|
|
p->TiltStatus = clamp(p->TiltStatus + (turndir && canTilt ? turndir : -Sgn(p->TiltStatus)), -10, 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2023-03-20 22:39:35 +00:00
|
|
|
static void doVehicleBumping(player_struct* p, DDukeActor* pact, unsigned flags, bool bumptest, int bumpscale)
|
2023-03-20 09:53:08 +00:00
|
|
|
{
|
|
|
|
if (p->MotoSpeed != 0 && p->on_ground == 1)
|
|
|
|
{
|
|
|
|
if (!p->VBumpNow && bumptest)
|
|
|
|
p->VBumpTarget = p->MotoSpeed * (1. / 16.) * bumpscale;
|
|
|
|
|
2023-03-20 22:39:35 +00:00
|
|
|
if ((flags & VEH_TURNLEFT) || p->moto_drink < 0)
|
2023-03-20 09:53:08 +00:00
|
|
|
{
|
|
|
|
if (p->moto_drink < 0)
|
|
|
|
p->moto_drink++;
|
|
|
|
}
|
2023-03-20 22:39:35 +00:00
|
|
|
else if ((flags & VEH_TURNRIGHT) || p->moto_drink > 0)
|
2023-03-20 09:53:08 +00:00
|
|
|
{
|
|
|
|
if (p->moto_drink > 0)
|
|
|
|
p->moto_drink--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->TurbCount)
|
|
|
|
{
|
|
|
|
if (p->TurbCount <= 1)
|
|
|
|
{
|
|
|
|
p->TurbCount = 0;
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->VBumpNow = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->TurbCount--;
|
|
|
|
p->moto_drink = (krand() & 3) - 2;
|
|
|
|
pact->spr.Angles.Pitch = -maphoriz((krand() & 15) - 7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->VBumpTarget > p->VBumpNow)
|
|
|
|
{
|
|
|
|
p->VBumpNow += p->moto_bump_fast ? 6 : 1;
|
|
|
|
if (p->VBumpTarget < p->VBumpNow)
|
|
|
|
p->VBumpNow = p->VBumpTarget;
|
|
|
|
pact->spr.Angles.Pitch = -maphoriz(p->VBumpNow * (1. / 3.));
|
|
|
|
}
|
|
|
|
else if (p->VBumpTarget < p->VBumpNow)
|
|
|
|
{
|
|
|
|
p->VBumpNow -= p->moto_bump_fast ? 6 : 1;
|
|
|
|
if (p->VBumpTarget > p->VBumpNow)
|
|
|
|
p->VBumpNow = p->VBumpTarget;
|
|
|
|
pact->spr.Angles.Pitch = -maphoriz(p->VBumpNow * (1. / 3.));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->moto_bump_fast = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2023-03-20 10:46:16 +00:00
|
|
|
static void doVehicleDrunk(player_struct* const p)
|
|
|
|
{
|
|
|
|
if (p->drink_amt > 88 && p->moto_drink == 0)
|
|
|
|
{
|
|
|
|
const int rng = krand() & 63;
|
|
|
|
if (rng == 1)
|
|
|
|
p->moto_drink = -10;
|
|
|
|
else if (rng == 2)
|
|
|
|
p->moto_drink = 10;
|
|
|
|
}
|
|
|
|
else if (p->drink_amt > 99 && p->moto_drink == 0)
|
|
|
|
{
|
|
|
|
const int rng = krand() & 31;
|
|
|
|
if (rng == 1)
|
|
|
|
p->moto_drink = -20;
|
|
|
|
else if (rng == 2)
|
|
|
|
p->moto_drink = 20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2023-03-20 22:39:35 +00:00
|
|
|
static void doVehicleSounds(player_struct* p, DDukeActor* pact, unsigned flags, unsigned sound1, unsigned sound2, unsigned sound3, unsigned sound4)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 23:41:46 +00:00
|
|
|
if ((p->OnBoat && (flags & VEH_FWDBRAKING) == VEH_FORWARD) || flags & VEH_FORWARD)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 09:54:34 +00:00
|
|
|
if (p->OnBoat || p->on_ground)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 23:39:24 +00:00
|
|
|
if (p->OnMotorcycle && p->MotoSpeed == 0 && (flags & VEH_BRAKING))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 09:54:34 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, sound1))
|
|
|
|
S_PlayActorSound(sound1, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2023-03-20 09:54:34 +00:00
|
|
|
else if (p->MotoSpeed == 0 && !S_CheckActorSoundPlaying(pact, sound3))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 09:54:34 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, sound1))
|
|
|
|
S_StopSound(sound1, pact);
|
|
|
|
S_PlayActorSound(sound3, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2023-03-20 09:54:34 +00:00
|
|
|
else if (p->MotoSpeed >= 50 && !S_CheckActorSoundPlaying(pact, sound2))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 09:54:34 +00:00
|
|
|
S_PlayActorSound(sound2, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2023-03-20 09:54:34 +00:00
|
|
|
else if (!S_CheckActorSoundPlaying(pact, sound2) && !S_CheckActorSoundPlaying(pact, sound3))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 09:54:34 +00:00
|
|
|
S_PlayActorSound(sound2, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-03-20 09:54:34 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, sound3))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 09:54:34 +00:00
|
|
|
S_StopSound(sound3, pact);
|
|
|
|
if (!S_CheckActorSoundPlaying(pact, sound4))
|
|
|
|
S_PlayActorSound(sound4, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2023-03-20 09:54:34 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, sound2))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 09:54:34 +00:00
|
|
|
S_StopSound(sound2, pact);
|
|
|
|
if (!S_CheckActorSoundPlaying(pact, sound4))
|
|
|
|
S_PlayActorSound(sound4, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2023-03-20 09:54:34 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, sound4) && !S_CheckActorSoundPlaying(pact, sound1))
|
|
|
|
S_PlayActorSound(sound1, pact);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2023-03-20 22:39:35 +00:00
|
|
|
static void doVehicleThrottling(player_struct* p, DDukeActor* pact, unsigned& flags, int fwdSpeed, int revSpeed, int brakeSpeed, int vBmpFwd, int vBmpBrake)
|
2023-03-20 09:54:34 +00:00
|
|
|
{
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->on_ground == 1)
|
|
|
|
{
|
2023-03-20 23:41:46 +00:00
|
|
|
if (p->OnBoat && (flags & VEH_FWDBRAKING) == VEH_FWDBRAKING)
|
2023-03-20 10:54:33 +00:00
|
|
|
{
|
|
|
|
if (p->MotoSpeed <= 25)
|
|
|
|
{
|
|
|
|
p->MotoSpeed++;
|
|
|
|
if (!S_CheckActorSoundPlaying(pact, 182))
|
|
|
|
S_PlayActorSound(182, pact);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->MotoSpeed -= brakeSpeed;
|
|
|
|
if (p->MotoSpeed < 0)
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->VBumpTarget = vBmpBrake;
|
|
|
|
p->moto_do_bump = 1;
|
|
|
|
}
|
|
|
|
}
|
2023-03-20 22:39:35 +00:00
|
|
|
else if ((flags & VEH_BRAKING) && p->MotoSpeed > 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 10:54:33 +00:00
|
|
|
p->MotoSpeed -= brakeSpeed;
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->MotoSpeed < 0)
|
|
|
|
p->MotoSpeed = 0;
|
2023-03-20 10:54:33 +00:00
|
|
|
p->VBumpTarget = vBmpBrake;
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_do_bump = 1;
|
|
|
|
}
|
2023-03-20 22:39:35 +00:00
|
|
|
else if ((flags & VEH_FORWARD) && (p->OnBoat || !(flags & VEH_BRAKING)))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 10:54:33 +00:00
|
|
|
if (p->MotoSpeed < 40 && (p->OnMotorcycle || !p->NotOnWater))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 10:54:33 +00:00
|
|
|
p->VBumpTarget = vBmpFwd;
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_bump_fast = 1;
|
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2023-03-20 10:54:33 +00:00
|
|
|
p->MotoSpeed += fwdSpeed * p->sync.fvel;
|
2023-03-20 23:39:24 +00:00
|
|
|
flags &= ~VEH_FORWARD;
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->MotoSpeed > 120)
|
|
|
|
p->MotoSpeed = 120;
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2023-03-20 10:54:33 +00:00
|
|
|
if (p->OnMotorcycle && !p->NotOnWater && p->MotoSpeed > 80)
|
2020-11-05 08:32:14 +00:00
|
|
|
p->MotoSpeed = 80;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else if (p->MotoSpeed > 0)
|
|
|
|
p->MotoSpeed--;
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2023-03-20 22:39:35 +00:00
|
|
|
if (p->moto_do_bump && (!(flags & VEH_BRAKING) || p->MotoSpeed == 0))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->moto_do_bump = 0;
|
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2023-03-20 22:39:35 +00:00
|
|
|
if ((flags & VEH_REVERSE) && p->MotoSpeed <= 0 && !(flags & VEH_BRAKING))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 22:39:35 +00:00
|
|
|
if (flags & VEH_TURNLEFT)
|
|
|
|
{
|
|
|
|
flags &= ~VEH_TURNLEFT;
|
|
|
|
flags |= VEH_TURNRIGHT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flags &= ~VEH_TURNRIGHT;
|
|
|
|
flags |= VEH_TURNLEFT;
|
|
|
|
}
|
2023-03-20 10:54:33 +00:00
|
|
|
p->MotoSpeed = revSpeed * p->sync.fvel;
|
2023-03-20 22:39:35 +00:00
|
|
|
flags &= ~VEH_REVERSE;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
2023-03-20 10:54:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void onMotorcycle(int snum, ESyncBits &actions)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
auto pact = p->GetActor();
|
|
|
|
|
|
|
|
if (p->MotoSpeed < 0 || p->moto_underwater)
|
|
|
|
p->MotoSpeed = 0;
|
2020-09-22 12:50:27 +00:00
|
|
|
|
2023-03-20 22:39:35 +00:00
|
|
|
unsigned flags = outVehicleFlags(p, actions);
|
2023-03-30 11:42:06 +00:00
|
|
|
doVehicleTilting(p, Sgn(p->sync.avel), !p->on_ground || p->sync.avel);
|
2023-03-20 22:39:35 +00:00
|
|
|
doVehicleSounds(p, pact, flags, 187, 188, 214, 189);
|
2023-03-20 10:54:33 +00:00
|
|
|
doVehicleDrunk(p);
|
2023-03-20 22:39:35 +00:00
|
|
|
doVehicleThrottling(p, pact, flags, 2, 15, p->moto_on_oil ? 2 : 4, 70, -30);
|
|
|
|
doVehicleBumping(p, pact, flags, (krand() & 3) == 2, (krand() & 7) - 4);
|
2020-09-22 12:50:27 +00:00
|
|
|
|
2023-03-20 09:15:53 +00:00
|
|
|
constexpr DAngle adjust = mapangle(-510);
|
2022-09-11 22:30:05 +00:00
|
|
|
DAngle velAdjustment;
|
|
|
|
|
2021-05-12 15:33:33 +00:00
|
|
|
int currSpeed = int(p->MotoSpeed);
|
2023-03-20 23:21:30 +00:00
|
|
|
if (p->MotoSpeed >= 20 && p->on_ground == 1 && (flags & VEH_TURNING))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2023-03-20 22:33:27 +00:00
|
|
|
velAdjustment = (flags & VEH_TURNLEFT) ? -adjust : adjust;
|
2023-03-20 09:15:53 +00:00
|
|
|
auto angAdjustment = (350 << 21) * velAdjustment.Sgn();
|
2020-11-04 21:22:01 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->moto_on_mud || p->moto_on_oil || !p->NotOnWater)
|
|
|
|
{
|
2020-11-06 04:59:24 +00:00
|
|
|
currSpeed <<= p->moto_on_oil ? 3 : 2;
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->moto_do_bump)
|
|
|
|
{
|
2020-11-06 04:59:24 +00:00
|
|
|
currSpeed >>= 5;
|
2020-11-04 21:22:01 +00:00
|
|
|
angAdjustment >>= 2;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-06 04:59:24 +00:00
|
|
|
currSpeed >>= 7;
|
2020-11-04 21:22:01 +00:00
|
|
|
angAdjustment >>= 6;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_on_mud = 0;
|
|
|
|
p->moto_on_oil = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p->moto_do_bump)
|
|
|
|
{
|
2020-11-06 04:59:24 +00:00
|
|
|
currSpeed >>= 5;
|
2020-11-04 21:22:01 +00:00
|
|
|
angAdjustment >>= 4;
|
2020-10-25 06:42:29 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, 220))
|
|
|
|
S_PlayActorSound(220, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-06 04:59:24 +00:00
|
|
|
currSpeed >>= 7;
|
2020-11-04 21:22:01 +00:00
|
|
|
angAdjustment >>= 7;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2023-03-20 09:15:53 +00:00
|
|
|
p->vel.XY() += (pact->spr.Angles.Yaw + velAdjustment).ToVector() * currSpeed;
|
|
|
|
pact->spr.Angles.Yaw -= DAngle::fromBam(angAdjustment);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil))
|
|
|
|
{
|
2023-03-20 10:46:16 +00:00
|
|
|
velAdjustment = krand() & 1 ? adjust : -adjust;
|
2021-01-04 11:36:54 +00:00
|
|
|
currSpeed = MulScale(currSpeed, p->moto_on_oil ? 10 : 5, 7);
|
2023-03-20 09:15:53 +00:00
|
|
|
p->vel.XY() += (pact->spr.Angles.Yaw + velAdjustment).ToVector() * currSpeed;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2021-01-03 08:25:49 +00:00
|
|
|
p->moto_on_mud = p->moto_on_oil = 0;
|
2023-03-19 10:39:52 +00:00
|
|
|
p->sync.fvel = clamp<float>((float)p->MotoSpeed, -15.f, 120.f) * (1.f / 40.f);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
static void onBoat(int snum, ESyncBits &actions)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-25 06:42:29 +00:00
|
|
|
auto pact = p->GetActor();
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
if (p->NotOnWater)
|
|
|
|
{
|
|
|
|
if (p->MotoSpeed > 0)
|
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, 88))
|
|
|
|
S_PlayActorSound(88, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, 87))
|
|
|
|
S_PlayActorSound(87, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->MotoSpeed < 0)
|
|
|
|
p->MotoSpeed = 0;
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2023-03-20 22:39:35 +00:00
|
|
|
unsigned flags = outVehicleFlags(p, actions);
|
2023-03-30 11:42:06 +00:00
|
|
|
doVehicleTilting(p, Sgn(p->sync.avel), (p->MotoSpeed != 0 && (p->sync.avel || p->moto_drink)) || !p->NotOnWater);
|
2023-03-20 22:39:35 +00:00
|
|
|
doVehicleSounds(p, pact, flags, 87, 88, 89, 90);
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
if (!p->NotOnWater)
|
|
|
|
{
|
2023-03-20 23:21:30 +00:00
|
|
|
if ((flags & VEH_TURNING) && !S_CheckActorSoundPlaying(pact, 91) && p->MotoSpeed > 30)
|
2023-03-20 22:39:35 +00:00
|
|
|
S_PlayActorSound(91, pact);
|
|
|
|
|
2023-03-20 10:46:16 +00:00
|
|
|
doVehicleDrunk(p);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2023-03-20 22:39:35 +00:00
|
|
|
doVehicleThrottling(p, pact, flags, 1, !p->NotOnWater ? 25 : 20, 2, -30, 30);
|
|
|
|
doVehicleBumping(p, pact, flags, (krand() & 15) == 14, (krand() & 7) - 4);
|
2020-09-22 12:50:27 +00:00
|
|
|
|
2023-03-20 23:21:30 +00:00
|
|
|
if (p->MotoSpeed > 0 && p->on_ground == 1 && (flags & VEH_TURNING))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2021-05-12 15:33:33 +00:00
|
|
|
int currSpeed = int(p->MotoSpeed * 4.);
|
2023-03-20 22:33:27 +00:00
|
|
|
constexpr DAngle adjust = mapangle(-510);
|
|
|
|
DAngle velAdjustment = (flags & VEH_TURNLEFT) ? -adjust : adjust;
|
2023-03-20 09:15:53 +00:00
|
|
|
auto angAdjustment = (350 << 21) * velAdjustment.Sgn();
|
2020-11-04 21:22:01 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->moto_do_bump)
|
|
|
|
{
|
2020-11-06 04:59:24 +00:00
|
|
|
currSpeed >>= 6;
|
2020-11-04 21:22:01 +00:00
|
|
|
angAdjustment >>= 5;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-06 04:59:24 +00:00
|
|
|
currSpeed >>= 7;
|
2020-11-04 21:22:01 +00:00
|
|
|
angAdjustment >>= 6;
|
2020-08-05 07:53:22 +00:00
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2023-03-20 09:15:53 +00:00
|
|
|
p->vel.XY() += (pact->spr.Angles.Yaw + velAdjustment).ToVector() * currSpeed;
|
|
|
|
pact->spr.Angles.Yaw -= DAngle::fromBam(angAdjustment);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
if (p->NotOnWater && p->MotoSpeed > 50)
|
2023-03-20 09:15:53 +00:00
|
|
|
p->MotoSpeed *= 0.5;
|
2023-03-19 09:42:12 +00:00
|
|
|
|
2023-03-19 10:39:52 +00:00
|
|
|
p->sync.fvel = clamp<float>((float)p->MotoSpeed, -15.f, 120.f) * (1.f / 40.f);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-14 20:02:28 +00:00
|
|
|
static void movement(int snum, ESyncBits actions, sectortype* psect, double floorz, double ceilingz, int shrunk, double truefdist, int psectlotag)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-25 06:21:33 +00:00
|
|
|
auto pact = p->GetActor();
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
if (p->airleft != 15 * 26)
|
|
|
|
p->airleft = 15 * 26; //Aprox twenty seconds.
|
|
|
|
|
|
|
|
if (p->scuba_on == 1)
|
|
|
|
p->scuba_on = 0;
|
|
|
|
|
2022-11-24 02:38:03 +00:00
|
|
|
double i = gs.playerheight;
|
2020-08-07 19:59:11 +00:00
|
|
|
if (psectlotag == ST_1_ABOVE_WATER && p->spritebridge == 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (shrunk == 0)
|
|
|
|
{
|
|
|
|
i = 34;
|
|
|
|
p->pycount += 32;
|
|
|
|
p->pycount &= 2047;
|
2022-09-03 22:04:01 +00:00
|
|
|
p->pyoff = BobVal(p->pycount) * 2;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else i = 12;
|
|
|
|
|
2022-09-14 16:19:05 +00:00
|
|
|
if (shrunk == 0 && truefdist <= gs.playerheight)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (p->on_ground == 1)
|
|
|
|
{
|
2020-10-25 06:21:33 +00:00
|
|
|
if (p->dummyplayersprite == nullptr)
|
2022-12-04 13:16:44 +00:00
|
|
|
p->dummyplayersprite = spawn(pact, RTILE_PLAYERONWATER);
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
p->footprintcount = 6;
|
2022-12-09 09:48:47 +00:00
|
|
|
if (tilesurface(p->cursector->floortexture) == TSURF_SLIME)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
p->footprintpal = 8;
|
|
|
|
p->footprintshade = 0;
|
|
|
|
}
|
2022-12-09 09:48:47 +00:00
|
|
|
else if (tilesurface(p->cursector->floortexture) == TSURF_OIL)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
p->footprintpal = 0;
|
|
|
|
p->footprintshade = 40;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->footprintpal = 0;
|
|
|
|
p->footprintshade = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!p->OnMotorcycle)
|
|
|
|
{
|
|
|
|
footprints(snum);
|
|
|
|
}
|
|
|
|
|
2022-11-21 04:20:08 +00:00
|
|
|
if (p->GetActor()->getOffsetZ() < floorz - i) //falling
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2022-11-21 04:20:08 +00:00
|
|
|
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (psect->floorstat & CSTAT_SECTOR_SLOPE) && p->GetActor()->getOffsetZ() >= (floorz - i - 16))
|
2022-11-21 04:34:37 +00:00
|
|
|
p->GetActor()->spr.pos.Z = floorz - i + gs.playerheight;
|
2020-05-17 21:44:53 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
p->on_ground = 0;
|
|
|
|
|
2022-11-21 04:20:08 +00:00
|
|
|
if ((p->OnMotorcycle || p->OnBoat) && floorz - i * 2 > p->GetActor()->getOffsetZ())
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (p->MotoOnGround)
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 80;
|
|
|
|
p->moto_bump_fast = 1;
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.Z -= (gs.gravity * p->MotoSpeed * (1. / 16.));
|
2020-05-17 21:44:53 +00:00
|
|
|
p->MotoOnGround = 0;
|
2020-10-25 06:21:33 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 188))
|
|
|
|
S_StopSound(188, pact);
|
|
|
|
S_PlayActorSound(189, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.Z += (gs.gravity - 5/16. + (int(120 - p->MotoSpeed) / 256.));
|
2020-10-25 06:21:33 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, 189) && !S_CheckActorSoundPlaying(pact, 190))
|
|
|
|
S_PlayActorSound(190, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.Z += (gs.gravity + 5/16.); // (TICSPERFRAME<<6);
|
2020-05-17 16:04:45 +00:00
|
|
|
|
2022-09-11 22:40:33 +00:00
|
|
|
if (p->vel.Z >= (16 + 8)) p->vel.Z = (16 + 8);
|
|
|
|
if (p->vel.Z > 2400 / 256 && p->falling_counter < 255)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
p->falling_counter++;
|
2020-10-25 06:21:33 +00:00
|
|
|
if (p->falling_counter == 38 && !S_CheckActorSoundPlaying(pact, DUKE_SCREAM))
|
|
|
|
S_PlayActorSound(DUKE_SCREAM, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
2022-11-21 04:20:08 +00:00
|
|
|
if (p->GetActor()->getOffsetZ() + p->vel.Z >= floorz - i) // hit the ground
|
2020-08-07 20:20:29 +00:00
|
|
|
{
|
2020-10-25 06:21:33 +00:00
|
|
|
S_StopSound(DUKE_SCREAM, pact);
|
2021-11-21 07:56:39 +00:00
|
|
|
if (!p->insector() || p->cursector->lotag != 1)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (isRRRA()) p->MotoOnGround = 1;
|
2021-11-21 07:56:39 +00:00
|
|
|
if (p->falling_counter > 62 || (isRRRA() && p->falling_counter > 2 && p->insector() && p->cursector->lotag == 802))
|
2020-05-17 21:44:53 +00:00
|
|
|
quickkill(p);
|
|
|
|
|
|
|
|
else if (p->falling_counter > 9)
|
|
|
|
{
|
|
|
|
int j = p->falling_counter;
|
2021-12-21 19:50:51 +00:00
|
|
|
pact->spr.extra -= j - (krand() & 3);
|
|
|
|
if (pact->spr.extra <= 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:21:33 +00:00
|
|
|
S_PlayActorSound(SQUISHED, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-25 06:21:33 +00:00
|
|
|
S_PlayActorSound(DUKE_LAND, pact);
|
|
|
|
S_PlayActorSound(DUKE_LAND_HURT, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SetPlayerPal(p, PalEntry(32, 16, 0, 0));
|
|
|
|
}
|
2022-09-11 22:40:33 +00:00
|
|
|
else if (p->vel.Z > 8)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (p->OnMotorcycle)
|
|
|
|
{
|
2020-10-25 06:21:33 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 190))
|
|
|
|
S_StopSound(190, pact);
|
|
|
|
S_PlayActorSound(191, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
p->TurbCount = 12;
|
|
|
|
}
|
2020-10-25 06:21:33 +00:00
|
|
|
else S_PlayActorSound(DUKE_LAND, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2022-09-11 22:40:33 +00:00
|
|
|
else if (p->vel.Z > 4 && p->OnMotorcycle)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:21:33 +00:00
|
|
|
S_PlayActorSound(DUKE_LAND, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
p->TurbCount = 12;
|
|
|
|
}
|
|
|
|
}
|
2020-08-07 20:20:29 +00:00
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->falling_counter = 0;
|
2020-10-25 06:21:33 +00:00
|
|
|
S_StopSound(-1, pact, CHAN_VOICE);
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2022-09-11 22:40:33 +00:00
|
|
|
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->vel.Z > 12)
|
|
|
|
p->hard_landing = uint8_t(p->vel.Z / 4. );
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
p->on_ground = 1;
|
|
|
|
|
2022-11-24 02:38:03 +00:00
|
|
|
if (i == gs.playerheight)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
//Smooth on the ground
|
|
|
|
|
2022-11-21 04:20:08 +00:00
|
|
|
double k = (floorz - i - p->GetActor()->getOffsetZ()) * 0.5;
|
2022-11-20 08:14:51 +00:00
|
|
|
p->GetActor()->spr.pos.Z += k;
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.Z -= 3;
|
2022-09-11 22:18:56 +00:00
|
|
|
if (p->vel.Z < 0) p->vel.Z = 0;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else if (p->jumping_counter == 0)
|
|
|
|
{
|
2022-11-21 04:20:08 +00:00
|
|
|
p->GetActor()->spr.pos.Z += ((floorz - i * 0.5) - p->GetActor()->getOffsetZ()) * 0.5; //Smooth on the water
|
|
|
|
if (p->on_warping_sector == 0 && p->GetActor()->getOffsetZ() > floorz - 16)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2022-11-21 04:34:37 +00:00
|
|
|
p->GetActor()->spr.pos.Z = floorz - 16 + gs.playerheight;
|
2022-09-11 22:18:56 +00:00
|
|
|
p->vel.Z *= 0.5;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
p->on_warping_sector = 0;
|
|
|
|
|
2023-03-17 22:15:15 +00:00
|
|
|
if ((actions & SB_CROUCH) && !p->OnMotorcycle)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
playerCrouch(snum);
|
|
|
|
}
|
|
|
|
|
2020-08-28 20:51:05 +00:00
|
|
|
if ((actions & SB_JUMP) == 0 && !p->OnMotorcycle && p->jumping_toggle == 1)
|
2020-05-17 21:44:53 +00:00
|
|
|
p->jumping_toggle = 0;
|
|
|
|
|
2020-08-28 20:51:05 +00:00
|
|
|
else if ((actions & SB_JUMP) && !p->OnMotorcycle && p->jumping_toggle == 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2022-09-14 20:04:41 +00:00
|
|
|
playerJump(snum, floorz, ceilingz);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->jumping_counter)
|
|
|
|
{
|
2020-08-28 20:51:05 +00:00
|
|
|
if ((actions & SB_JUMP) == 0 && !p->OnMotorcycle && p->jumping_toggle == 1)
|
2020-05-17 21:44:53 +00:00
|
|
|
p->jumping_toggle = 0;
|
|
|
|
|
|
|
|
if (p->jumping_counter < 768)
|
|
|
|
{
|
2020-08-07 19:59:11 +00:00
|
|
|
if (psectlotag == ST_1_ABOVE_WATER && p->jumping_counter > 768)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
p->jumping_counter = 0;
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.Z = -2;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.Z -= BobVal(2048 - 128 + p->jumping_counter) * (64. / 12);
|
2020-05-17 21:44:53 +00:00
|
|
|
p->jumping_counter += 180;
|
|
|
|
p->on_ground = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->jumping_counter = 0;
|
2022-09-11 22:18:56 +00:00
|
|
|
p->vel.Z = 0;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-20 08:14:51 +00:00
|
|
|
p->GetActor()->spr.pos.Z += p->vel.Z;
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2022-11-21 04:20:08 +00:00
|
|
|
if (p->GetActor()->getOffsetZ() < ceilingz + 4)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
p->jumping_counter = 0;
|
2022-09-11 22:18:56 +00:00
|
|
|
if (p->vel.Z < 0)
|
|
|
|
p->vel.X = p->vel.Y = 0;
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.Z = 0.5;
|
2022-11-21 04:34:37 +00:00
|
|
|
p->GetActor()->spr.pos.Z = ceilingz + 4 + gs.playerheight;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-14 20:02:28 +00:00
|
|
|
static void underwater(int snum, ESyncBits actions, double floorz, double ceilingz)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-25 06:42:29 +00:00
|
|
|
auto pact = p->GetActor();
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
p->jumping_counter = 0;
|
|
|
|
|
|
|
|
p->pycount += 32;
|
|
|
|
p->pycount &= 2047;
|
2022-09-03 22:04:01 +00:00
|
|
|
p->pyoff = BobVal(p->pycount);
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2020-10-25 06:42:29 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, DUKE_UNDERWATER))
|
|
|
|
S_PlayActorSound(DUKE_UNDERWATER, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2020-08-28 20:51:05 +00:00
|
|
|
if ((actions & SB_JUMP) && !p->OnMotorcycle)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2022-09-11 22:18:56 +00:00
|
|
|
if (p->vel.Z > 0) p->vel.Z = 0;
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.Z -= (348 / 256.);
|
|
|
|
if (p->vel.Z < -6) p->vel.Z = -6;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2021-01-24 07:59:08 +00:00
|
|
|
else if ((actions & SB_CROUCH) || p->OnMotorcycle)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2022-09-11 22:18:56 +00:00
|
|
|
if (p->vel.Z < 0) p->vel.Z = 0;
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.Z += (348 / 256.);
|
|
|
|
if (p->vel.Z > 6) p->vel.Z = 6;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-11 22:18:56 +00:00
|
|
|
if (p->vel.Z < 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.Z += 1;
|
2022-09-11 22:18:56 +00:00
|
|
|
if (p->vel.Z > 0)
|
|
|
|
p->vel.Z = 0;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2022-09-11 22:18:56 +00:00
|
|
|
if (p->vel.Z > 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.Z -= 1;
|
2022-09-11 22:18:56 +00:00
|
|
|
if (p->vel.Z < 0)
|
|
|
|
p->vel.Z = 0;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-11 22:40:33 +00:00
|
|
|
if (p->vel.Z > 8)
|
2022-09-11 22:18:56 +00:00
|
|
|
p->vel.Z *= 0.5;
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2022-11-20 08:14:51 +00:00
|
|
|
p->GetActor()->spr.pos.Z += p->vel.Z;
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2022-11-21 04:20:08 +00:00
|
|
|
if (p->GetActor()->getOffsetZ() > floorz - 15)
|
|
|
|
p->GetActor()->spr.pos.Z += ((floorz - 15) - p->GetActor()->getOffsetZ()) * 0.5;
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2022-11-21 04:20:08 +00:00
|
|
|
if (p->GetActor()->getOffsetZ() < ceilingz + 4)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2022-11-21 04:34:37 +00:00
|
|
|
p->GetActor()->spr.pos.Z = ceilingz + 4 + gs.playerheight;
|
2022-09-11 22:18:56 +00:00
|
|
|
p->vel.Z = 0;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (p->scuba_on && (krand() & 255) < 8)
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
auto j = spawn(pact, RTILE_WATERBUBBLE);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (j)
|
|
|
|
{
|
2022-11-25 11:30:40 +00:00
|
|
|
j->spr.pos += (p->GetActor()->spr.Angles.Yaw.ToVector() + DVector2(12 - (global_random & 8), 12 - (global_random & 8))) * 16;
|
2022-10-07 21:52:29 +00:00
|
|
|
j->spr.scale = DVector2(0.046875, 0.03125);
|
2022-11-21 04:20:08 +00:00
|
|
|
j->spr.pos.Z = p->GetActor()->getOffsetZ() + 8;
|
2021-12-21 17:19:45 +00:00
|
|
|
j->spr.cstat = CSTAT_SPRITE_TRANS_FLIP | CSTAT_SPRITE_TRANSLUCENT;
|
2021-11-19 11:32:12 +00:00
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-18 16:34:31 +00:00
|
|
|
void onMotorcycleMove(int snum, walltype* wal)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-25 06:42:29 +00:00
|
|
|
auto pact = p->GetActor();
|
2022-11-25 11:30:40 +00:00
|
|
|
double angleDelta = absangle(p->GetActor()->spr.Angles.Yaw, wal->delta().Angle()).Degrees();
|
2022-07-21 10:18:40 +00:00
|
|
|
double damageAmount = p->MotoSpeed * p->MotoSpeed;
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2022-09-28 03:50:18 +00:00
|
|
|
const double scale = (180. / 2048.);
|
2022-12-04 10:58:36 +00:00
|
|
|
p->GetActor()->spr.Angles.Yaw += DAngle::fromDeg(p->MotoSpeed * (krand() & 1 ? -scale : scale));
|
2020-05-17 22:10:42 +00:00
|
|
|
|
2022-09-15 16:52:39 +00:00
|
|
|
// That's some very weird angles here...
|
|
|
|
if (angleDelta >= 77.51 && angleDelta <= 102.13)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2022-07-21 10:18:40 +00:00
|
|
|
damageAmount *= (1. / 256.);
|
2020-05-17 22:10:42 +00:00
|
|
|
p->MotoSpeed = 0;
|
2020-10-25 06:42:29 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 238) == 0)
|
|
|
|
S_PlayActorSound(238, pact);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
2022-09-15 16:52:39 +00:00
|
|
|
else if (angleDelta >= 54.66 && angleDelta <= 125)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2022-07-21 10:18:40 +00:00
|
|
|
damageAmount *= (1. / 2048.);
|
2020-11-04 22:17:18 +00:00
|
|
|
p->MotoSpeed -= (p->MotoSpeed / 2.) + (p->MotoSpeed / 4.);
|
2020-10-25 06:42:29 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 238) == 0)
|
|
|
|
S_PlayActorSound(238, pact);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
2022-09-15 16:52:39 +00:00
|
|
|
else if (angleDelta >= 19.51 && angleDelta <= 160.14)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2022-07-21 10:18:40 +00:00
|
|
|
damageAmount *= (1. / 16384.);
|
2020-11-04 22:17:18 +00:00
|
|
|
p->MotoSpeed -= p->MotoSpeed / 2.;
|
2020-10-25 06:42:29 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 239) == 0)
|
|
|
|
S_PlayActorSound(239, pact);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-07-21 10:18:40 +00:00
|
|
|
damageAmount *= (1. / 32768.);
|
2020-11-04 22:17:18 +00:00
|
|
|
p->MotoSpeed -= p->MotoSpeed / 8.;
|
2020-10-25 06:42:29 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 240) == 0)
|
|
|
|
S_PlayActorSound(240, pact);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
2022-07-21 10:18:40 +00:00
|
|
|
pact->spr.extra -= int(damageAmount);
|
2021-12-21 19:50:51 +00:00
|
|
|
if (pact->spr.extra <= 0)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
S_PlayActorSound(SQUISHED, pact);
|
2020-05-17 22:10:42 +00:00
|
|
|
SetPlayerPal(p, PalEntry(63, 63, 0, 0));
|
|
|
|
}
|
2020-11-04 21:22:01 +00:00
|
|
|
else if (damageAmount)
|
2020-10-25 06:42:29 +00:00
|
|
|
S_PlayActorSound(DUKE_LAND_HURT, pact);
|
2020-05-17 22:10:42 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-18 16:34:31 +00:00
|
|
|
void onBoatMove(int snum, int psectlotag, walltype* wal)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-25 06:42:29 +00:00
|
|
|
auto pact = p->GetActor();
|
2022-11-25 11:30:40 +00:00
|
|
|
double angleDelta = absangle(p->GetActor()->spr.Angles.Yaw, wal->delta().Angle()).Degrees();
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2022-09-28 03:50:18 +00:00
|
|
|
const double scale = (90. / 2048.);
|
2022-12-04 10:58:36 +00:00
|
|
|
p->GetActor()->spr.Angles.Yaw += DAngle::fromDeg(p->MotoSpeed * (krand() & 1 ? -scale : scale));
|
2020-05-17 22:10:42 +00:00
|
|
|
|
2022-09-15 16:52:39 +00:00
|
|
|
if (angleDelta >= 77.51 && angleDelta <= 102.13)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-11-04 22:17:18 +00:00
|
|
|
p->MotoSpeed = ((p->MotoSpeed / 2.) + (p->MotoSpeed / 4.)) / 4.;
|
2020-11-05 08:32:14 +00:00
|
|
|
if (psectlotag == 1 && S_CheckActorSoundPlaying(pact, 178) == 0)
|
|
|
|
S_PlayActorSound(178, pact);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
2022-09-15 16:52:39 +00:00
|
|
|
else if (angleDelta >= 54.66 && angleDelta <= 125)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-11-04 22:17:18 +00:00
|
|
|
p->MotoSpeed -= ((p->MotoSpeed / 2.) + (p->MotoSpeed / 4.)) / 8.;
|
2020-11-05 08:32:14 +00:00
|
|
|
if (psectlotag == 1 && S_CheckActorSoundPlaying(pact, 179) == 0)
|
|
|
|
S_PlayActorSound(179, pact);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
2022-09-15 16:52:39 +00:00
|
|
|
else if (angleDelta >= 19.51 && angleDelta <= 160.14)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-11-04 22:17:18 +00:00
|
|
|
p->MotoSpeed -= p->MotoSpeed / 16.;
|
2020-11-05 08:32:14 +00:00
|
|
|
if (psectlotag == 1 && S_CheckActorSoundPlaying(pact, 180) == 0)
|
|
|
|
S_PlayActorSound(180, pact);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-04 22:17:18 +00:00
|
|
|
p->MotoSpeed -= p->MotoSpeed / 64.;
|
2020-11-05 08:32:14 +00:00
|
|
|
if (psectlotag == 1 && S_CheckActorSoundPlaying(pact, 181) == 0)
|
|
|
|
S_PlayActorSound(181, pact);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2020-05-17 22:10:42 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-25 07:09:24 +00:00
|
|
|
void onMotorcycleHit(int snum, DDukeActor* victim)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2022-11-26 13:48:51 +00:00
|
|
|
if (badguy(victim) || victim->isPlayer())
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2022-11-26 13:48:51 +00:00
|
|
|
if (!victim->isPlayer())
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
|
|
|
if (numplayers == 1)
|
|
|
|
{
|
2020-10-25 07:09:24 +00:00
|
|
|
Collision coll;
|
2022-11-25 11:30:40 +00:00
|
|
|
DAngle ang = DAngle::fromBuild(p->TiltStatus * 20) + p->GetActor()->spr.Angles.Yaw;
|
2022-09-13 18:03:38 +00:00
|
|
|
movesprite_ex(victim, DVector3(ang.ToVector() * 4, victim->vel.Z), CLIPMASK0, coll);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2020-10-25 07:09:24 +00:00
|
|
|
victim->SetHitOwner(p->GetActor());
|
2022-12-04 13:16:44 +00:00
|
|
|
victim->attackertype = RTILE_MOTOHIT;
|
2022-07-21 10:18:40 +00:00
|
|
|
victim->hitextra = int(p->MotoSpeed * 0.5);
|
2020-11-04 22:17:18 +00:00
|
|
|
p->MotoSpeed -= p->MotoSpeed / 4.;
|
2020-05-17 22:10:42 +00:00
|
|
|
p->TurbCount = 6;
|
|
|
|
}
|
2022-11-22 16:53:46 +00:00
|
|
|
else if (p->MotoSpeed > 45)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2022-11-22 16:53:46 +00:00
|
|
|
CallOnMotoSmash(victim, p);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-25 07:09:24 +00:00
|
|
|
void onBoatHit(int snum, DDukeActor* victim)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-12 21:06:08 +00:00
|
|
|
|
2022-11-26 13:48:51 +00:00
|
|
|
if (badguy(victim) || victim->isPlayer())
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2022-11-26 13:48:51 +00:00
|
|
|
if (!victim->isPlayer())
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
|
|
|
if (numplayers == 1)
|
|
|
|
{
|
2020-10-25 07:09:24 +00:00
|
|
|
Collision coll;
|
2022-11-25 11:30:40 +00:00
|
|
|
DAngle ang = DAngle::fromBuild(p->TiltStatus * 20) + p->GetActor()->spr.Angles.Yaw;
|
2022-09-13 18:03:38 +00:00
|
|
|
movesprite_ex(victim, DVector3(ang.ToVector() * 2, victim->vel.Z), CLIPMASK0, coll);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2020-10-25 07:09:24 +00:00
|
|
|
victim->SetHitOwner(p->GetActor());
|
2022-12-04 13:16:44 +00:00
|
|
|
victim->attackertype = RTILE_MOTOHIT;
|
2022-07-21 10:18:40 +00:00
|
|
|
victim->hitextra = int(p->MotoSpeed * 0.25);
|
2020-11-04 22:17:18 +00:00
|
|
|
p->MotoSpeed -= p->MotoSpeed / 4.;
|
2020-05-17 22:10:42 +00:00
|
|
|
p->TurbCount = 6;
|
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-05-18 06:26:09 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
static void fireweapon(int snum)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
|
2020-08-27 05:54:49 +00:00
|
|
|
p->crack_time = CRACK_TIME;
|
2020-05-18 06:26:09 +00:00
|
|
|
|
|
|
|
if (p->holster_weapon == 1)
|
|
|
|
{
|
|
|
|
if (p->last_pissed_time <= (26 * 218) && p->weapon_pos == -9)
|
|
|
|
{
|
|
|
|
p->holster_weapon = 0;
|
2020-09-16 11:01:09 +00:00
|
|
|
p->oweapon_pos = p->weapon_pos = 10;
|
2020-05-18 06:26:09 +00:00
|
|
|
FTA(74, p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-19 16:40:40 +00:00
|
|
|
if (!isRRRA() && p->curr_weapon >= MOTORCYCLE_WEAPON) return;
|
2020-05-18 06:26:09 +00:00
|
|
|
switch (p->curr_weapon)
|
|
|
|
{
|
|
|
|
case DYNAMITE_WEAPON:
|
|
|
|
p->hbomb_hold_delay = 0;
|
|
|
|
if (p->ammo_amount[DYNAMITE_WEAPON] > 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
2020-05-20 08:38:56 +00:00
|
|
|
case THROWINGDYNAMITE_WEAPON:
|
2020-05-18 06:26:09 +00:00
|
|
|
p->hbomb_hold_delay = 0;
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PISTOL_WEAPON:
|
|
|
|
if (p->ammo_amount[PISTOL_WEAPON] > 0)
|
|
|
|
{
|
|
|
|
p->ammo_amount[PISTOL_WEAPON]--;
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIFLEGUN_WEAPON:
|
|
|
|
if (p->ammo_amount[RIFLEGUN_WEAPON] > 0) // && p->random_club_frame == 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SHOTGUN_WEAPON:
|
|
|
|
if (p->ammo_amount[SHOTGUN_WEAPON] > 0 && p->random_club_frame == 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BOWLING_WEAPON:
|
|
|
|
if (p->ammo_amount[BOWLING_WEAPON] > 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
case POWDERKEG_WEAPON:
|
|
|
|
if (p->ammo_amount[POWDERKEG_WEAPON] > 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BUZZSAW_WEAPON:
|
|
|
|
case THROWSAW_WEAPON:
|
|
|
|
if (p->curr_weapon == BUZZSAW_WEAPON)
|
|
|
|
{
|
|
|
|
if (p->ammo_amount[BUZZSAW_WEAPON] > 0)
|
|
|
|
{
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(431, p->GetActor());
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->ammo_amount[THROWSAW_WEAPON] > 0)
|
|
|
|
{
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(SHRINKER_FIRE, p->GetActor());
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ALIENBLASTER_WEAPON:
|
|
|
|
if (p->ammo_amount[ALIENBLASTER_WEAPON] > 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TIT_WEAPON:
|
|
|
|
if (p->ammo_amount[TIT_WEAPON] > 0)
|
|
|
|
{
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
p->hbomb_hold_delay = !p->hbomb_hold_delay;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MOTORCYCLE_WEAPON:
|
|
|
|
if (p->ammo_amount[MOTORCYCLE_WEAPON] > 0)
|
|
|
|
{
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
p->hbomb_hold_delay = !p->hbomb_hold_delay;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOAT_WEAPON:
|
|
|
|
if (p->ammo_amount[BOAT_WEAPON] > 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CROSSBOW_WEAPON:
|
|
|
|
if (p->ammo_amount[CROSSBOW_WEAPON] > 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CHICKEN_WEAPON:
|
|
|
|
if (p->ammo_amount[CHICKEN_WEAPON] > 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case KNEE_WEAPON:
|
|
|
|
case SLINGBLADE_WEAPON:
|
|
|
|
if (p->curr_weapon == SLINGBLADE_WEAPON)
|
|
|
|
{
|
|
|
|
if (p->ammo_amount[SLINGBLADE_WEAPON] > 0)
|
|
|
|
if (p->quick_kick == 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
else if (!isRRRA() || p->ammo_amount[KNEE_WEAPON] > 0)
|
|
|
|
if (p->quick_kick == 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-18 19:17:47 +00:00
|
|
|
static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-24 05:34:39 +00:00
|
|
|
auto pact = p->GetActor();
|
2021-12-07 10:42:21 +00:00
|
|
|
int psectlotag = psectp ? psectp->lotag : 857;
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-19 16:40:40 +00:00
|
|
|
if (!isRRRA() && p->curr_weapon >= MOTORCYCLE_WEAPON) return;
|
2020-05-18 06:26:09 +00:00
|
|
|
switch (p->curr_weapon)
|
|
|
|
{
|
2020-05-18 20:28:12 +00:00
|
|
|
case DYNAMITE_WEAPON:
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 1)
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(401);
|
2020-08-28 20:51:05 +00:00
|
|
|
if (p->kickback_pic == 6 && (actions & SB_FIRE))
|
2020-05-18 06:26:09 +00:00
|
|
|
p->rapid_fire_hold = 1;
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic > 19)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-20 08:38:56 +00:00
|
|
|
p->curr_weapon = THROWINGDYNAMITE_WEAPON;
|
2020-05-18 06:26:09 +00:00
|
|
|
p->last_weapon = -1;
|
2020-09-16 11:01:09 +00:00
|
|
|
p->oweapon_pos = p->weapon_pos = 10;
|
2020-05-18 20:28:12 +00:00
|
|
|
p->detonate_time = 45;
|
|
|
|
p->detonate_count = 1;
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(402);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
2020-05-20 08:38:56 +00:00
|
|
|
case THROWINGDYNAMITE_WEAPON:
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-18 20:28:12 +00:00
|
|
|
if (p->detonate_time < 0)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
p->hbomb_on = 0;
|
|
|
|
}
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 39)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
p->hbomb_on = 0;
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 512;
|
2020-05-18 06:26:09 +00:00
|
|
|
madenoise(snum);
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 12)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-09-15 17:03:24 +00:00
|
|
|
double vel, zvel;
|
|
|
|
|
2020-05-18 20:28:12 +00:00
|
|
|
p->ammo_amount[DYNAMITE_WEAPON]--;
|
|
|
|
if (p->ammo_amount[CROSSBOW_WEAPON])
|
|
|
|
p->ammo_amount[CROSSBOW_WEAPON]--;
|
2022-09-15 17:03:24 +00:00
|
|
|
|
|
|
|
if (p->on_ground && (actions & SB_CROUCH))
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-09-15 17:03:24 +00:00
|
|
|
vel = 15 / 16.;
|
2022-11-25 11:24:32 +00:00
|
|
|
zvel = p->Angles.getPitchWithView().Sin() * 10.;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-15 17:03:24 +00:00
|
|
|
vel = 140 / 16.;
|
2022-11-25 11:24:32 +00:00
|
|
|
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
2022-10-11 03:37:36 +00:00
|
|
|
zvel -= 4;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
auto spawned = CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + p->GetActor()->spr.Angles.Yaw.ToVector() * 16, RTILE_DYNAMITE, -16, DVector2(0.140625, 0.140625),
|
2022-11-25 11:30:40 +00:00
|
|
|
p->GetActor()->spr.Angles.Yaw, (vel + p->hbomb_hold_delay * 2) * 2, zvel, pact, 1);
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2021-11-19 08:47:17 +00:00
|
|
|
if (spawned)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-09-15 17:03:24 +00:00
|
|
|
if (vel == 15 / 16.)
|
2021-11-19 08:47:17 +00:00
|
|
|
{
|
2022-09-01 16:15:52 +00:00
|
|
|
spawned->spr.yint = 3;
|
2022-02-07 07:47:18 +00:00
|
|
|
spawned->spr.pos.Z += 8;
|
2021-11-19 08:47:17 +00:00
|
|
|
}
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2022-10-12 17:00:43 +00:00
|
|
|
double hd = hits(p->GetActor());
|
2022-09-13 22:05:32 +00:00
|
|
|
if (hd < 32)
|
2021-11-19 08:47:17 +00:00
|
|
|
{
|
2022-11-25 12:13:50 +00:00
|
|
|
spawned->spr.Angles.Yaw += DAngle180;
|
2022-09-03 08:04:16 +00:00
|
|
|
spawned->vel *= 1./3.;
|
2021-11-19 08:47:17 +00:00
|
|
|
}
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2021-11-19 08:47:17 +00:00
|
|
|
p->hbomb_on = 1;
|
|
|
|
}
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-08-28 20:51:05 +00:00
|
|
|
else if (p->kickback_pic < 12 && (actions & SB_FIRE))
|
2020-05-18 06:26:09 +00:00
|
|
|
p->hbomb_hold_delay++;
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 40)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 20:28:12 +00:00
|
|
|
p->curr_weapon = DYNAMITE_WEAPON;
|
2020-05-18 06:26:09 +00:00
|
|
|
p->last_weapon = -1;
|
2020-05-18 20:28:12 +00:00
|
|
|
p->detonate_count = 0;
|
|
|
|
p->detonate_time = 45;
|
|
|
|
if (p->ammo_amount[DYNAMITE_WEAPON] > 0)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-11-12 08:33:33 +00:00
|
|
|
fi.addweapon(p, DYNAMITE_WEAPON, true);
|
2020-09-16 11:01:09 +00:00
|
|
|
p->oweapon_pos = p->weapon_pos = -9;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
else checkavailweapon(p);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PISTOL_WEAPON:
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 1)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_SHOTSPARK1, nullptr);
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(PISTOL_FIRE, pact);
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 512;
|
2020-05-18 06:26:09 +00:00
|
|
|
madenoise(snum);
|
|
|
|
|
2021-02-18 10:46:36 +00:00
|
|
|
lastvisinc = PlayClock + 32;
|
2020-05-18 06:26:09 +00:00
|
|
|
p->visibility = 0;
|
|
|
|
if (psectlotag != 857)
|
|
|
|
{
|
2022-11-25 11:30:40 +00:00
|
|
|
p->vel.XY() -= p->GetActor()->spr.Angles.Yaw.ToVector();
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic == 2)
|
2020-05-18 06:26:09 +00:00
|
|
|
if (p->ammo_amount[PISTOL_WEAPON] <= 0)
|
|
|
|
{
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic >= 22)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
if (p->ammo_amount[PISTOL_WEAPON] <= 0)
|
|
|
|
{
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if ((p->ammo_amount[PISTOL_WEAPON] % 6) == 0)
|
|
|
|
{
|
2020-05-19 07:03:07 +00:00
|
|
|
switch (p->kickback_pic)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
case 24:
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(EJECT_CLIP, pact);
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
case 30:
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(INSERT_CLIP, pact);
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic = 38;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 38)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SHOTGUN_WEAPON:
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 6)
|
2020-05-18 20:28:12 +00:00
|
|
|
if (p->shotgun_state[0] == 0)
|
2020-05-18 06:26:09 +00:00
|
|
|
if (p->ammo_amount[SHOTGUN_WEAPON] > 1)
|
2020-08-28 20:51:05 +00:00
|
|
|
if (actions & SB_FIRE)
|
2020-05-18 20:28:12 +00:00
|
|
|
p->shotgun_state[1] = 1;
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 4)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
2020-05-18 06:26:09 +00:00
|
|
|
|
|
|
|
p->ammo_amount[SHOTGUN_WEAPON]--;
|
|
|
|
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(SHOTGUN_FIRE, pact);
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 512;
|
2020-05-18 06:26:09 +00:00
|
|
|
madenoise(snum);
|
|
|
|
|
2021-02-18 10:46:36 +00:00
|
|
|
lastvisinc = PlayClock + 32;
|
2020-05-18 06:26:09 +00:00
|
|
|
p->visibility = 0;
|
|
|
|
}
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 7)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-05-18 20:28:12 +00:00
|
|
|
if (p->shotgun_state[1])
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
|
|
|
fi.shoot(pact, RTILE_SHOTGUN, nullptr);
|
2020-05-18 06:26:09 +00:00
|
|
|
|
|
|
|
p->ammo_amount[SHOTGUN_WEAPON]--;
|
|
|
|
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(SHOTGUN_FIRE, pact);
|
2020-05-18 06:26:09 +00:00
|
|
|
|
|
|
|
if (psectlotag != 857)
|
|
|
|
{
|
2022-11-25 11:30:40 +00:00
|
|
|
p->vel.XY() -= p->GetActor()->spr.Angles.Yaw.ToVector() * 2;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (psectlotag != 857)
|
|
|
|
{
|
2022-11-25 11:30:40 +00:00
|
|
|
p->vel.XY() -= p->GetActor()->spr.Angles.Yaw.ToVector();
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-18 20:28:12 +00:00
|
|
|
if (p->shotgun_state[0])
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-05-19 07:03:07 +00:00
|
|
|
switch (p->kickback_pic)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
case 16:
|
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
|
|
|
case 17:
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(SHOTGUN_COCK, pact);
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
case 28:
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 20:28:12 +00:00
|
|
|
p->shotgun_state[0] = 0;
|
|
|
|
p->shotgun_state[1] = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-05-18 20:28:12 +00:00
|
|
|
else if (p->shotgun_state[1])
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-05-19 07:03:07 +00:00
|
|
|
switch (p->kickback_pic)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
case 26:
|
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
|
|
|
case 27:
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(SHOTGUN_COCK, pact);
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
case 38:
|
2020-08-27 12:47:18 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 20:28:12 +00:00
|
|
|
p->shotgun_state[0] = 0;
|
|
|
|
p->shotgun_state[1] = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-19 07:03:07 +00:00
|
|
|
switch (p->kickback_pic)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
case 16:
|
|
|
|
checkavailweapon(p);
|
2020-08-27 12:47:18 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 20:28:12 +00:00
|
|
|
p->shotgun_state[0] = 1;
|
|
|
|
p->shotgun_state[1] = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-05-18 20:28:12 +00:00
|
|
|
case RIFLEGUN_WEAPON:
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
2022-12-04 10:43:44 +00:00
|
|
|
p->GetActor()->spr.Angles.Pitch -= DAngle::fromDeg(0.4476);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->recoil++;
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic <= 12)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-05-19 07:03:07 +00:00
|
|
|
if ((p->kickback_pic % 3) == 0)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-05-18 20:28:12 +00:00
|
|
|
p->ammo_amount[RIFLEGUN_WEAPON]--;
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if ((p->kickback_pic % 3) == 0)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
auto j = spawn(pact, RTILE_SHELL);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (j)
|
|
|
|
{
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2022-11-25 12:13:50 +00:00
|
|
|
j->spr.Angles.Yaw += DAngle180;
|
2022-09-11 17:28:45 +00:00
|
|
|
j->vel.X += 2.;
|
2022-02-07 07:47:18 +00:00
|
|
|
j->spr.pos.Z += 3;
|
2021-11-19 11:32:12 +00:00
|
|
|
ssp(j, CLIPMASK0);
|
|
|
|
}
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(CHAINGUN_FIRE, pact);
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_CHAINGUN, nullptr);
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 512;
|
2020-05-18 06:26:09 +00:00
|
|
|
madenoise(snum);
|
2021-02-18 10:46:36 +00:00
|
|
|
lastvisinc = PlayClock + 32;
|
2020-05-18 06:26:09 +00:00
|
|
|
p->visibility = 0;
|
|
|
|
|
|
|
|
if (psectlotag != 857)
|
|
|
|
{
|
2022-11-25 11:30:40 +00:00
|
|
|
p->vel.XY() -= p->GetActor()->spr.Angles.Yaw.ToVector();
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
checkavailweapon(p);
|
|
|
|
|
2020-08-28 20:51:05 +00:00
|
|
|
if ((actions & SB_FIRE) == 0)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic > 10)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-08-28 20:51:05 +00:00
|
|
|
if (actions & SB_FIRE) p->kickback_pic = 1;
|
2020-09-16 11:01:09 +00:00
|
|
|
else p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2020-05-18 20:28:12 +00:00
|
|
|
case BUZZSAW_WEAPON:
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic > 3)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_GROWSPARK, nullptr);
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 64;
|
2020-05-18 20:28:12 +00:00
|
|
|
madenoise(snum);
|
|
|
|
checkavailweapon(p);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
else p->kickback_pic++;
|
2020-05-18 20:28:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case THROWSAW_WEAPON:
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 1)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-05-19 07:54:52 +00:00
|
|
|
p->ammo_amount[THROWSAW_WEAPON]--;
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_SAWBLADE, nullptr);
|
2020-05-18 20:28:12 +00:00
|
|
|
checkavailweapon(p);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic > 20)
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
|
2020-05-18 20:28:12 +00:00
|
|
|
case TIT_WEAPON:
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic == 2 || p->kickback_pic == 4)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
p->visibility = 0;
|
2021-02-18 10:46:36 +00:00
|
|
|
lastvisinc = PlayClock + 32;
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(CHAINGUN_FIRE, pact);
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_SHOTSPARK1, nullptr);
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 1024;
|
2020-05-18 06:26:09 +00:00
|
|
|
madenoise(snum);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->ammo_amount[TIT_WEAPON]--;
|
2020-05-18 06:26:09 +00:00
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 2)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-12-04 10:58:36 +00:00
|
|
|
p->GetActor()->spr.Angles.Yaw += mapangle(16);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic == 4)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-12-04 10:58:36 +00:00
|
|
|
p->GetActor()->spr.Angles.Yaw -= mapangle(16);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic > 4)
|
|
|
|
p->kickback_pic = 1;
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!(actions & SB_FIRE))
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
2020-05-18 20:28:12 +00:00
|
|
|
|
|
|
|
case MOTORCYCLE_WEAPON:
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic == 2 || p->kickback_pic == 4)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
p->visibility = 0;
|
2021-02-18 10:46:36 +00:00
|
|
|
lastvisinc = PlayClock + 32;
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(CHAINGUN_FIRE, pact);
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_CHAINGUN, nullptr);
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 1024;
|
2020-05-18 06:26:09 +00:00
|
|
|
madenoise(snum);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->ammo_amount[MOTORCYCLE_WEAPON]--;
|
|
|
|
if (p->ammo_amount[MOTORCYCLE_WEAPON] <= 0)
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
else
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 2)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-12-04 10:58:36 +00:00
|
|
|
p->GetActor()->spr.Angles.Yaw += mapangle(4);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic == 4)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-12-04 10:58:36 +00:00
|
|
|
p->GetActor()->spr.Angles.Yaw -= mapangle(4);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic > 4)
|
|
|
|
p->kickback_pic = 1;
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!(actions & SB_FIRE))
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
2020-05-18 20:28:12 +00:00
|
|
|
case BOAT_WEAPON:
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 3)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
p->MotoSpeed -= 20;
|
2020-05-18 20:28:12 +00:00
|
|
|
p->ammo_amount[BOAT_WEAPON]--;
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_BOATGRENADE, nullptr);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic > 20)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
2020-05-18 20:28:12 +00:00
|
|
|
if (p->ammo_amount[BOAT_WEAPON] <= 0)
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
else
|
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
|
|
|
|
2020-05-18 20:28:12 +00:00
|
|
|
case ALIENBLASTER_WEAPON:
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic >= 7 && p->kickback_pic <= 11)
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_FIRELASER, nullptr);
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 5)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(CAT_FIRE, pact);
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 128;
|
2020-05-18 06:26:09 +00:00
|
|
|
madenoise(snum);
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic == 9)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-05-18 20:28:12 +00:00
|
|
|
p->ammo_amount[ALIENBLASTER_WEAPON]--;
|
2020-05-18 06:26:09 +00:00
|
|
|
p->visibility = 0;
|
2021-02-18 10:46:36 +00:00
|
|
|
lastvisinc = PlayClock + 32;
|
2020-05-18 06:26:09 +00:00
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic == 12)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-11-25 11:30:40 +00:00
|
|
|
p->vel.XY() -= p->GetActor()->spr.Angles.Yaw.ToVector();
|
2022-12-04 10:43:44 +00:00
|
|
|
p->GetActor()->spr.Angles.Pitch -= DAngle::fromDeg(8.88);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->recoil += 20;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic > 20)
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
|
|
|
|
2020-05-18 20:28:12 +00:00
|
|
|
case POWDERKEG_WEAPON:
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 3)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-09-15 17:03:24 +00:00
|
|
|
double vel, zvel;
|
2020-05-18 20:28:12 +00:00
|
|
|
p->ammo_amount[POWDERKEG_WEAPON]--;
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[POWDERKEG_WEAPON] = false;
|
2020-08-28 20:51:05 +00:00
|
|
|
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-09-15 17:03:24 +00:00
|
|
|
vel = 15 / 16.;
|
2022-11-25 11:24:32 +00:00
|
|
|
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-05-18 20:28:12 +00:00
|
|
|
else
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-09-15 17:03:24 +00:00
|
|
|
vel = 2.;
|
2022-11-25 11:24:32 +00:00
|
|
|
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
2022-10-11 03:37:36 +00:00
|
|
|
zvel -= 4;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-05-18 20:28:12 +00:00
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + p->GetActor()->spr.Angles.Yaw.ToVector() * 16, RTILE_POWDERKEG, -16, DVector2(0.140625, 0.140625), p->GetActor()->spr.Angles.Yaw, vel * 2, zvel, pact, 1);
|
2020-05-18 20:28:12 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic > 20)
|
2020-05-18 20:28:12 +00:00
|
|
|
{
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 20:28:12 +00:00
|
|
|
checkavailweapon(p);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
break;
|
2020-05-18 20:28:12 +00:00
|
|
|
|
|
|
|
case BOWLING_WEAPON:
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 30)
|
2020-05-18 20:28:12 +00:00
|
|
|
{
|
|
|
|
p->ammo_amount[BOWLING_WEAPON]--;
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(354, pact);
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_BOWLINGBALL, nullptr);
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 64;
|
2020-05-18 20:28:12 +00:00
|
|
|
madenoise(snum);
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic < 30)
|
2020-05-18 20:28:12 +00:00
|
|
|
{
|
2022-11-25 11:30:40 +00:00
|
|
|
p->vel.XY() += p->GetActor()->spr.Angles.Yaw.ToVector();
|
2020-05-18 20:28:12 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic > 40)
|
2020-05-18 20:28:12 +00:00
|
|
|
{
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[BOWLING_WEAPON] = false;
|
2020-05-18 20:28:12 +00:00
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-05-18 06:26:09 +00:00
|
|
|
case KNEE_WEAPON:
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic == 3)
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(426, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 12)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_KNEE, nullptr);
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 64;
|
2020-05-18 06:26:09 +00:00
|
|
|
madenoise(snum);
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic == 16)
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
|
|
|
|
if (p->wantweaponfire >= 0)
|
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
2020-05-18 20:28:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
case SLINGBLADE_WEAPON:
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic == 3)
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(252, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic == 8)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_SLINGBLADE, nullptr);
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 64;
|
2020-05-18 06:26:09 +00:00
|
|
|
madenoise(snum);
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic == 16)
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
|
|
|
|
if (p->wantweaponfire >= 0)
|
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
|
|
|
|
2020-05-18 20:28:12 +00:00
|
|
|
case CROSSBOW_WEAPON:
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic == 4)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-05-18 20:28:12 +00:00
|
|
|
p->ammo_amount[CROSSBOW_WEAPON]--;
|
|
|
|
if (p->ammo_amount[DYNAMITE_WEAPON])
|
|
|
|
p->ammo_amount[DYNAMITE_WEAPON]--;
|
2021-02-18 10:46:36 +00:00
|
|
|
lastvisinc = PlayClock + 32;
|
2020-05-18 06:26:09 +00:00
|
|
|
p->visibility = 0;
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_RPG, nullptr);
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 2048;
|
2020-05-18 06:26:09 +00:00
|
|
|
madenoise(snum);
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic == 16)
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(450, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic == 34)
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
2020-05-18 20:28:12 +00:00
|
|
|
|
|
|
|
case CHICKEN_WEAPON:
|
2020-05-19 07:03:07 +00:00
|
|
|
p->kickback_pic++;
|
|
|
|
if (p->kickback_pic == 4)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-05-18 20:28:12 +00:00
|
|
|
p->ammo_amount[CHICKEN_WEAPON]--;
|
2021-02-18 10:46:36 +00:00
|
|
|
lastvisinc = PlayClock + 32;
|
2020-05-18 06:26:09 +00:00
|
|
|
p->visibility = 0;
|
2022-12-04 13:16:44 +00:00
|
|
|
fi.shoot(pact, RTILE_RPG2, nullptr);
|
2022-09-14 15:35:44 +00:00
|
|
|
p->noise_radius = 2048;
|
2020-05-18 06:26:09 +00:00
|
|
|
madenoise(snum);
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic == 16)
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(450, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (p->kickback_pic == 34)
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-18 06:26:09 +00:00
|
|
|
break;
|
2020-05-18 20:28:12 +00:00
|
|
|
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-05-19 07:54:52 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// this function exists because gotos suck. :P
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-18 19:17:47 +00:00
|
|
|
static void processweapon(int snum, ESyncBits actions, sectortype* psectp)
|
2020-05-19 07:54:52 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-25 07:12:25 +00:00
|
|
|
auto pact = p->GetActor();
|
2022-10-07 21:33:37 +00:00
|
|
|
int shrunk = (pact->spr.scale.Y < 0.125);
|
2020-05-19 07:54:52 +00:00
|
|
|
|
|
|
|
if (p->detonate_count > 0)
|
|
|
|
{
|
|
|
|
if (ud.god)
|
|
|
|
{
|
|
|
|
p->detonate_time = 45;
|
|
|
|
p->detonate_count = 0;
|
|
|
|
}
|
|
|
|
else if (p->detonate_time <= 0 && p->kickback_pic < 5)
|
|
|
|
{
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(14);
|
2020-05-19 07:54:52 +00:00
|
|
|
quickkill(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isRRRA() && (p->curr_weapon == KNEE_WEAPON || p->curr_weapon == SLINGBLADE_WEAPON))
|
|
|
|
p->random_club_frame += 64;
|
|
|
|
|
|
|
|
if (p->curr_weapon == THROWSAW_WEAPON || p->curr_weapon == BUZZSAW_WEAPON)
|
|
|
|
p->random_club_frame += 64; // Glowing
|
|
|
|
|
|
|
|
if (p->curr_weapon == TRIPBOMB_WEAPON || p->curr_weapon == BOWLING_WEAPON)
|
|
|
|
p->random_club_frame += 64;
|
|
|
|
|
|
|
|
if (p->rapid_fire_hold == 1)
|
|
|
|
{
|
2020-08-28 20:51:05 +00:00
|
|
|
if (actions & SB_FIRE) return;
|
2020-05-19 07:54:52 +00:00
|
|
|
p->rapid_fire_hold = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (shrunk || p->tipincs || p->access_incs)
|
2020-08-28 20:51:05 +00:00
|
|
|
actions &= ~SB_FIRE;
|
|
|
|
else if (shrunk == 0 && (actions & SB_FIRE) && p->kickback_pic == 0 && p->fist_incs == 0 &&
|
2020-05-19 07:54:52 +00:00
|
|
|
p->last_weapon == -1 && (p->weapon_pos == 0 || p->holster_weapon == 1))
|
|
|
|
{
|
|
|
|
fireweapon(snum);
|
|
|
|
}
|
|
|
|
else if (p->kickback_pic)
|
|
|
|
{
|
2021-11-18 19:17:47 +00:00
|
|
|
operateweapon(snum, actions, psectp);
|
2020-05-19 07:54:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void processinput_r(int snum)
|
|
|
|
{
|
2022-09-30 15:57:22 +00:00
|
|
|
int k, doubvel;
|
2020-10-25 07:25:45 +00:00
|
|
|
Collision chz, clz;
|
2021-11-07 15:46:23 +00:00
|
|
|
bool shrunk;
|
2021-11-21 07:50:04 +00:00
|
|
|
int psectlotag;
|
2022-09-14 16:19:05 +00:00
|
|
|
double floorz = 0, ceilingz = 0;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-10-25 07:12:25 +00:00
|
|
|
auto p = &ps[snum];
|
|
|
|
auto pact = p->GetActor();
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2021-04-21 10:41:04 +00:00
|
|
|
ESyncBits& actions = p->sync.actions;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2021-11-21 07:56:39 +00:00
|
|
|
auto psectp = p->cursector;
|
2021-12-21 19:50:51 +00:00
|
|
|
if (p->OnMotorcycle && pact->spr.extra > 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-08-29 11:32:14 +00:00
|
|
|
onMotorcycle(snum, actions);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2021-12-21 19:50:51 +00:00
|
|
|
else if (p->OnBoat && pact->spr.extra > 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-08-29 11:32:14 +00:00
|
|
|
onBoat(snum, actions);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2023-03-19 09:42:12 +00:00
|
|
|
|
|
|
|
processinputvel(snum);
|
|
|
|
auto sb_fvel = PlayerInputForwardVel(snum);
|
|
|
|
auto sb_svel = PlayerInputSideVel(snum);
|
|
|
|
|
2021-11-21 07:50:04 +00:00
|
|
|
if (psectp == nullptr)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-12-21 19:50:51 +00:00
|
|
|
if (pact->spr.extra > 0 && ud.clipping == 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
quickkill(p);
|
2020-10-25 07:12:25 +00:00
|
|
|
S_PlayActorSound(SQUISHED, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2021-11-21 07:50:04 +00:00
|
|
|
psectp = §or[0];
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2021-11-18 16:34:31 +00:00
|
|
|
psectlotag = psectp->lotag;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
if (psectlotag == 867)
|
|
|
|
{
|
2021-11-21 07:50:04 +00:00
|
|
|
DukeSectIterator it(psectp);
|
2020-10-25 07:25:45 +00:00
|
|
|
while (auto act2 = it.Next())
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-12-09 07:28:55 +00:00
|
|
|
if (act2->spr.picnum == RTILE_WATERSURFACE)
|
2022-11-21 04:20:08 +00:00
|
|
|
if (act2->spr.pos.Z - 8 < p->GetActor()->getOffsetZ())
|
2022-12-09 07:28:55 +00:00
|
|
|
psectlotag = ST_2_UNDERWATER;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
2021-05-02 12:01:10 +00:00
|
|
|
else if (psectlotag == 7777 && (currentLevel->gameflags & LEVEL_RR_HULKSPAWN))
|
2020-05-19 07:03:07 +00:00
|
|
|
lastlevel = 1;
|
|
|
|
|
2022-12-09 09:48:47 +00:00
|
|
|
if (psectlotag == 848 && tilesurface(psectp->floortexture) == TSURF_SPECIALWATER)
|
2022-12-09 07:28:55 +00:00
|
|
|
psectlotag = ST_1_ABOVE_WATER;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
if (psectlotag == 857)
|
2022-10-04 17:13:26 +00:00
|
|
|
pact->clipdist = 0.25;
|
2020-05-19 07:03:07 +00:00
|
|
|
else
|
2022-10-04 17:08:29 +00:00
|
|
|
pact->clipdist = 16;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
p->spritebridge = 0;
|
|
|
|
|
2022-10-07 21:33:37 +00:00
|
|
|
shrunk = (pact->spr.scale.Y < 0.125);
|
2022-10-04 17:25:06 +00:00
|
|
|
if (pact->clipdist == 16)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-11-24 02:20:17 +00:00
|
|
|
getzrange(p->GetActor()->getPosWithOffsetZ(), psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-11-24 02:20:17 +00:00
|
|
|
getzrange(p->GetActor()->getPosWithOffsetZ(), psectp, &ceilingz, chz, &floorz, clz, 0.25, CLIPMASK0);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
2023-03-16 11:24:34 +00:00
|
|
|
setPlayerActorViewZOffset(pact);
|
2023-03-16 11:15:11 +00:00
|
|
|
|
|
|
|
p->truefz = getflorzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());
|
2022-11-24 02:20:17 +00:00
|
|
|
p->truecz = getceilzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2023-03-16 11:15:11 +00:00
|
|
|
double truefdist = abs(p->GetActor()->getOffsetZ() - p->truefz);
|
2022-09-14 16:19:05 +00:00
|
|
|
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + 16)
|
2020-05-19 07:03:07 +00:00
|
|
|
psectlotag = 0;
|
|
|
|
|
2022-09-14 16:19:05 +00:00
|
|
|
pact->floorz = floorz;
|
|
|
|
pact->ceilingz = ceilingz;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2022-11-25 10:18:36 +00:00
|
|
|
doslopetilting(p);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-10-25 07:25:45 +00:00
|
|
|
if (chz.type == kHitSprite)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (chz.actor()->spr.statnum == 1 && chz.actor()->spr.extra >= 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
chz.setNone();
|
2022-09-14 16:19:05 +00:00
|
|
|
ceilingz = p->truecz;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2022-12-04 13:16:44 +00:00
|
|
|
else if (chz.actor()->spr.picnum == RTILE_LADDER)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
if (!p->stairs)
|
|
|
|
{
|
|
|
|
p->stairs = 10;
|
2020-08-28 20:51:05 +00:00
|
|
|
if ((actions & SB_JUMP) && !p->OnMotorcycle)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
chz.setNone();
|
2022-09-14 16:19:05 +00:00
|
|
|
ceilingz = p->truecz;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p->stairs--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-25 07:25:45 +00:00
|
|
|
if (clz.type == kHitSprite)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-07-21 10:18:40 +00:00
|
|
|
auto doVehicleHit = [&]()
|
|
|
|
{
|
|
|
|
if (badguy(clz.actor()))
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
clz.actor()->attackertype = RTILE_MOTOHIT;
|
2022-07-21 10:18:40 +00:00
|
|
|
clz.actor()->hitextra = int(2 + (p->MotoSpeed * 0.5));
|
|
|
|
p->MotoSpeed -= p->MotoSpeed * (1. / 16.);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if ((clz.actor()->spr.cstat & (CSTAT_SPRITE_ALIGNMENT_FLOOR| CSTAT_SPRITE_BLOCK)) == (CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_BLOCK))
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
psectlotag = 0;
|
|
|
|
p->footprintcount = 0;
|
|
|
|
p->spritebridge = 1;
|
|
|
|
}
|
|
|
|
if (p->OnMotorcycle)
|
2022-07-21 10:18:40 +00:00
|
|
|
doVehicleHit();
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->OnBoat)
|
|
|
|
{
|
2022-07-21 10:18:40 +00:00
|
|
|
doVehicleHit();
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2022-10-07 21:33:37 +00:00
|
|
|
else if (badguy(clz.actor()) && clz.actor()->spr.scale.X > 0.375 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < 84)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-11-24 02:20:17 +00:00
|
|
|
auto ang = (clz.actor()->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle();
|
2022-09-11 22:40:33 +00:00
|
|
|
p->vel.XY() -= ang.ToVector();
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2022-12-04 13:16:44 +00:00
|
|
|
if (clz.actor()->spr.picnum == RTILE_LADDER)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
if (!p->stairs)
|
|
|
|
{
|
|
|
|
p->stairs = 10;
|
2020-08-28 20:51:05 +00:00
|
|
|
if ((actions & SB_CROUCH) && !p->OnMotorcycle)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-09-14 16:19:05 +00:00
|
|
|
ceilingz = clz.actor()->spr.pos.Z;
|
2021-11-26 12:41:15 +00:00
|
|
|
chz.setNone();
|
2022-09-14 16:19:05 +00:00
|
|
|
floorz = clz.actor()->spr.pos.Z + 4;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p->stairs--;
|
|
|
|
}
|
2022-12-02 22:26:55 +00:00
|
|
|
else CallStandingOn(clz.actor(), p);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-21 19:50:51 +00:00
|
|
|
if (pact->spr.extra > 0) fi.incur_damage(p);
|
2020-05-19 07:03:07 +00:00
|
|
|
else
|
|
|
|
{
|
2021-12-21 19:50:51 +00:00
|
|
|
pact->spr.extra = 0;
|
2020-05-19 07:03:07 +00:00
|
|
|
p->shield_amount = 0;
|
|
|
|
}
|
|
|
|
|
2021-12-21 19:50:51 +00:00
|
|
|
p->last_extra = pact->spr.extra;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2022-06-06 01:24:38 +00:00
|
|
|
if (p->loogcnt > 0)
|
|
|
|
{
|
|
|
|
p->oloogcnt = p->loogcnt;
|
|
|
|
p->loogcnt--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->oloogcnt = p->loogcnt = 0;
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
if (p->fist_incs)
|
|
|
|
{
|
|
|
|
if (endoflevel(snum)) return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->timebeforeexit > 1 && p->last_extra > 0)
|
|
|
|
{
|
|
|
|
if (timedexit(snum))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-21 19:50:51 +00:00
|
|
|
if (pact->spr.extra <= 0 && !ud.god)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-09-14 16:19:05 +00:00
|
|
|
playerisdead(snum, psectlotag, floorz, ceilingz);
|
2020-07-16 13:03:09 +00:00
|
|
|
return;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
2022-10-07 21:33:37 +00:00
|
|
|
if (p->GetActor()->spr.scale.X < 0.125 && p->jetpack_on == 0)
|
2022-06-06 01:04:51 +00:00
|
|
|
{
|
|
|
|
p->ofistsign = p->fistsign;
|
2022-10-12 17:00:43 +00:00
|
|
|
p->fistsign += int(p->GetActor()->vel.X * 16);
|
2022-06-06 01:04:51 +00:00
|
|
|
}
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->transporter_hold > 0)
|
|
|
|
{
|
|
|
|
p->transporter_hold--;
|
|
|
|
if (p->transporter_hold == 0 && p->on_warping_sector)
|
|
|
|
p->transporter_hold = 2;
|
|
|
|
}
|
|
|
|
if (p->transporter_hold < 0)
|
|
|
|
p->transporter_hold++;
|
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
if (p->newOwner != nullptr)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2023-03-23 06:09:02 +00:00
|
|
|
setForcedSyncInput(snum);
|
2022-09-11 22:26:24 +00:00
|
|
|
p->vel.X = p->vel.Y = 0;
|
2022-09-03 08:02:25 +00:00
|
|
|
pact->vel.X = 0;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
fi.doincrements(p);
|
|
|
|
|
2021-11-18 19:17:47 +00:00
|
|
|
if (p->curr_weapon == THROWINGDYNAMITE_WEAPON) processweapon(snum, actions, psectp);
|
2020-05-19 07:03:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
doubvel = TICSPERFRAME;
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
checklook(snum, actions);
|
2023-03-21 10:37:25 +00:00
|
|
|
p->Angles.doViewYaw(&p->sync);
|
2022-12-09 06:52:52 +00:00
|
|
|
p->apply_seasick();
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2023-03-26 02:34:58 +00:00
|
|
|
p->updatecentering(snum);
|
2023-03-23 05:34:07 +00:00
|
|
|
|
2020-10-17 08:44:00 +00:00
|
|
|
if (p->on_crane != nullptr)
|
2023-03-18 08:28:02 +00:00
|
|
|
{
|
2023-03-23 06:09:02 +00:00
|
|
|
setForcedSyncInput(snum);
|
2020-05-19 07:03:07 +00:00
|
|
|
goto HORIZONLY;
|
2023-03-18 08:28:02 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2022-09-15 16:41:01 +00:00
|
|
|
p->playerweaponsway(pact->vel.X);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2022-11-20 08:07:23 +00:00
|
|
|
pact->vel.X = clamp((p->GetActor()->spr.pos.XY() - p->bobpos).Length(), 0., 32.);
|
2022-09-14 16:19:05 +00:00
|
|
|
if (p->on_ground) p->bobcounter += int(p->GetActor()->vel.X * 8);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2022-12-09 09:48:47 +00:00
|
|
|
p->backuppos(ud.clipping == 0 && ((p->insector() && p->cursector->floortexture == mirrortex) || !p->insector()));
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2023-03-21 10:37:25 +00:00
|
|
|
p->Angles.doYawKeys(&p->sync);
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
// Shrinking code
|
|
|
|
|
2020-07-16 13:03:09 +00:00
|
|
|
if (psectlotag == ST_17_PLATFORM_UP || (isRRRA() && psectlotag == ST_18_ELEVATOR_DOWN))
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
int tmp;
|
2022-09-12 17:47:07 +00:00
|
|
|
tmp = getanimationindex(anim_floorz, p->cursector);
|
2020-05-19 07:03:07 +00:00
|
|
|
if (tmp >= 0)
|
|
|
|
{
|
2020-11-02 19:24:07 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, 432))
|
2020-10-25 07:12:25 +00:00
|
|
|
S_PlayActorSound(432, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
2020-07-25 07:32:54 +00:00
|
|
|
S_StopSound(432);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
if (isRRRA() && p->sea_sick_stat)
|
|
|
|
{
|
|
|
|
p->pycount += 32;
|
|
|
|
p->pycount &= 2047;
|
2022-09-03 22:04:01 +00:00
|
|
|
p->pyoff = BobVal(p->pycount) * (p->SeaSick? 32 : 1);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
2020-07-16 13:03:09 +00:00
|
|
|
if (psectlotag == ST_2_UNDERWATER)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-09-14 20:02:28 +00:00
|
|
|
underwater(snum, actions, floorz, ceilingz);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2020-08-07 19:59:11 +00:00
|
|
|
else
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-09-14 20:02:28 +00:00
|
|
|
movement(snum, actions, psectp, floorz, ceilingz, shrunk, truefdist, psectlotag);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
2020-08-05 12:57:47 +00:00
|
|
|
p->psectlotag = psectlotag;
|
|
|
|
|
2021-01-02 00:04:03 +00:00
|
|
|
if (movementBlocked(p))
|
2020-08-05 07:53:22 +00:00
|
|
|
{
|
|
|
|
doubvel = 0;
|
2022-09-11 22:18:56 +00:00
|
|
|
p->vel.X = 0;
|
|
|
|
p->vel.Y = 0;
|
2023-03-23 06:09:02 +00:00
|
|
|
setForcedSyncInput(snum);
|
2020-08-05 07:53:22 +00:00
|
|
|
}
|
2020-11-30 22:40:16 +00:00
|
|
|
else if (SyncInput())
|
2020-08-05 07:53:22 +00:00
|
|
|
{
|
|
|
|
//p->ang += syncangvel * constant
|
|
|
|
//ENGINE calculates angvel for you
|
|
|
|
// may still be needed later for demo recording
|
|
|
|
|
2022-12-09 07:09:59 +00:00
|
|
|
p->GetActor()->spr.Angles.Yaw += p->adjustavel(PlayerInputAngVel(snum));
|
2020-08-05 07:53:22 +00:00
|
|
|
}
|
|
|
|
|
2022-12-08 20:58:05 +00:00
|
|
|
purplelavacheck(p);
|
2022-12-09 07:09:59 +00:00
|
|
|
|
2021-12-30 15:24:51 +00:00
|
|
|
if (p->spritebridge == 0 && pact->insector())
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-12-08 23:44:48 +00:00
|
|
|
auto sect = pact->sector();
|
2020-05-19 07:03:07 +00:00
|
|
|
k = 0;
|
|
|
|
|
2022-09-14 16:19:05 +00:00
|
|
|
if (p->on_ground && truefdist <= gs.playerheight + 16)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-12-09 09:48:47 +00:00
|
|
|
int surface = tilesurface(sect->floortexture);
|
2022-12-08 23:44:48 +00:00
|
|
|
int whichsound = surface == TSURF_ELECTRIC ? 0 : surface == TSURF_SLIME ? 1 : surface == TSURF_PLASMA ? 2 : surface == TSURF_MAGMA ? 3 : -1;
|
|
|
|
k = makepainsounds(snum, whichsound);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (k)
|
|
|
|
{
|
|
|
|
FTA(75, p);
|
|
|
|
p->boot_amount -= 2;
|
|
|
|
if (p->boot_amount <= 0)
|
|
|
|
checkavailinven(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-11 22:26:24 +00:00
|
|
|
if (p->vel.X || p->vel.Y || sb_fvel || sb_svel)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-08-27 05:54:49 +00:00
|
|
|
p->crack_time = CRACK_TIME;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2022-09-15 17:23:47 +00:00
|
|
|
k = int(BobVal(p->bobcounter) * 4);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
if (isRRRA() && p->spritebridge == 0 && p->on_ground)
|
|
|
|
{
|
2022-12-08 20:58:05 +00:00
|
|
|
if (psectlotag == ST_1_ABOVE_WATER)
|
2020-05-19 07:03:07 +00:00
|
|
|
p->NotOnWater = 0;
|
|
|
|
else if (p->OnBoat)
|
|
|
|
{
|
|
|
|
if (psectlotag == 1234)
|
|
|
|
p->NotOnWater = 0;
|
|
|
|
else
|
|
|
|
p->NotOnWater = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p->NotOnWater = 1;
|
|
|
|
}
|
|
|
|
|
2022-11-24 08:41:58 +00:00
|
|
|
if (truefdist < gs.playerheight + 8 && (k == 1 || k == 3))
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
if (p->spritebridge == 0 && p->walking_snd_toggle == 0 && p->on_ground)
|
|
|
|
{
|
2022-12-09 07:28:55 +00:00
|
|
|
FTextureID j;
|
2020-05-19 07:03:07 +00:00
|
|
|
switch (psectlotag)
|
|
|
|
{
|
|
|
|
case 0:
|
2020-10-25 07:25:45 +00:00
|
|
|
if (clz.type == kHitSprite)
|
2022-12-09 07:28:55 +00:00
|
|
|
j = clz.actor()->spr.spritetexture();
|
|
|
|
else
|
2022-12-09 09:48:47 +00:00
|
|
|
j = psectp->floortexture;
|
2022-12-09 07:28:55 +00:00
|
|
|
|
|
|
|
if (tilesurface(j) == TSURF_METALDUCTS)
|
|
|
|
{
|
|
|
|
S_PlayActorSound(S_FindSound("PLAYER_WALKINDUCTS"), pact); // Duke's sound slot is not available here.
|
|
|
|
p->walking_snd_toggle = 1;
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if ((krand() & 1) == 0)
|
2021-11-21 07:56:39 +00:00
|
|
|
if (!isRRRA() || (!p->OnBoat && !p->OnMotorcycle && p->cursector->hitag != 321))
|
2020-10-25 07:12:25 +00:00
|
|
|
S_PlayActorSound(DUKE_ONWATER, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
p->walking_snd_toggle = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->walking_snd_toggle > 0)
|
|
|
|
p->walking_snd_toggle--;
|
|
|
|
|
|
|
|
if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400)
|
|
|
|
doubvel <<= 1;
|
|
|
|
|
2022-09-19 23:54:01 +00:00
|
|
|
p->vel.X += sb_fvel * doubvel * (5. / 16.);
|
|
|
|
p->vel.Y += sb_svel * doubvel * (5. / 16.);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!isRRRA() && ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH))))
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-09-11 22:08:42 +00:00
|
|
|
p->vel.XY() *= gs.playerfriction - 0.125;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (psectlotag == 2)
|
|
|
|
{
|
2022-09-11 22:08:42 +00:00
|
|
|
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1400);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-11 22:08:42 +00:00
|
|
|
p->vel.XY() *= gs.playerfriction;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-09 09:48:47 +00:00
|
|
|
if (tilesurface(psectp->floortexture) == TSURF_OIL)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
if (p->OnMotorcycle)
|
|
|
|
if (p->on_ground)
|
|
|
|
p->moto_on_oil = 1;
|
|
|
|
}
|
2022-12-09 09:48:47 +00:00
|
|
|
else if (tilesurface(psectp->floortexture) == TSURF_DEEPMUD)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
if (p->OnMotorcycle)
|
|
|
|
{
|
|
|
|
if (p->on_ground)
|
|
|
|
p->moto_on_mud = 1;
|
|
|
|
}
|
|
|
|
else if (p->boot_amount > 0)
|
|
|
|
p->boot_amount--;
|
|
|
|
else
|
|
|
|
{
|
2022-09-11 22:08:42 +00:00
|
|
|
p->vel.XY() *= gs.playerfriction;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
2022-12-09 09:48:47 +00:00
|
|
|
else if (tilesurface(psectp->floortexture) == TSURF_MUDDY)
|
2022-12-09 07:28:55 +00:00
|
|
|
{
|
|
|
|
if (p->OnMotorcycle)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-12-09 07:28:55 +00:00
|
|
|
if (p->on_ground)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-12-09 07:28:55 +00:00
|
|
|
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1800);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
2022-12-09 07:28:55 +00:00
|
|
|
else
|
|
|
|
if (p->boot_amount > 0)
|
|
|
|
p->boot_amount--;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1800);
|
|
|
|
}
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2022-09-11 22:40:33 +00:00
|
|
|
if (abs(p->vel.X) < 1 / 128. && abs(p->vel.Y) < 1 / 128.)
|
2022-09-11 22:08:42 +00:00
|
|
|
p->vel.X = p->vel.Y = 0;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
if (shrunk)
|
|
|
|
{
|
2022-09-11 22:23:37 +00:00
|
|
|
p->vel.XY() *= gs.playerfriction * 0.75;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HORIZONLY:
|
|
|
|
|
2023-03-21 10:37:25 +00:00
|
|
|
double iif = (psectlotag == 1 || p->spritebridge == 1) ? 4 : 20;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2021-11-21 07:56:39 +00:00
|
|
|
if (p->insector() && p->cursector->lotag == 2) k = 0;
|
2020-05-19 07:03:07 +00:00
|
|
|
else k = 1;
|
|
|
|
|
2020-10-25 07:25:45 +00:00
|
|
|
Collision clip{};
|
2020-05-19 07:03:07 +00:00
|
|
|
if (ud.clipping)
|
|
|
|
{
|
2022-11-20 08:07:23 +00:00
|
|
|
p->GetActor()->spr.pos.XY() += p->vel.XY() ;
|
2022-11-24 02:20:17 +00:00
|
|
|
updatesector(p->GetActor()->getPosWithOffsetZ(), &p->cursector);
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorSect(pact, p->cursector);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
2022-11-21 04:20:08 +00:00
|
|
|
clipmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, p->vel, 10.25, 4., iif, CLIPMASK0, clip);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
|
2022-11-20 08:14:51 +00:00
|
|
|
p->GetActor()->spr.pos.Z += 32;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-10-25 07:50:03 +00:00
|
|
|
if (clip.type != kHitNone)
|
|
|
|
checkplayerhurt_r(p, clip);
|
2020-05-19 07:03:07 +00:00
|
|
|
else if (isRRRA() && p->hurt_delay2 > 0)
|
|
|
|
p->hurt_delay2--;
|
|
|
|
|
|
|
|
|
2020-10-25 07:50:03 +00:00
|
|
|
if (clip.type == kHitWall)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
auto wal = clip.hitWall;
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->OnMotorcycle)
|
|
|
|
{
|
2021-11-18 16:34:31 +00:00
|
|
|
onMotorcycleMove(snum, wal);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else if (p->OnBoat)
|
|
|
|
{
|
2021-11-18 16:34:31 +00:00
|
|
|
onBoatMove(snum, psectlotag, wal);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-17 21:48:48 +00:00
|
|
|
if (wal->lotag >= 40 && wal->lotag <= 44)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-11-17 21:48:48 +00:00
|
|
|
if (wal->lotag < 44)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
dofurniture(clip.hitWall, p->cursector, snum);
|
2022-11-21 04:20:08 +00:00
|
|
|
pushmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, 10.75, 4, 4, CLIPMASK0);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
2022-11-21 04:20:08 +00:00
|
|
|
pushmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, 10.75, 4, 4, CLIPMASK0);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-25 07:50:03 +00:00
|
|
|
if (clip.type == kHitSprite)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
if (p->OnMotorcycle)
|
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
onMotorcycleHit(snum, clip.actor());
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else if (p->OnBoat)
|
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
onBoatHit(snum, clip.actor());
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2021-11-26 12:41:15 +00:00
|
|
|
else if (badguy(clip.actor()))
|
2020-11-05 06:30:56 +00:00
|
|
|
{
|
2022-12-12 16:51:02 +00:00
|
|
|
if (clip.actor()->spr.statnum != STAT_ACTOR)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
clip.actor()->timetosleep = 0;
|
2022-12-04 13:16:44 +00:00
|
|
|
if (clip.actor()->spr.picnum == RTILE_BILLYRAY)
|
2021-11-26 12:41:15 +00:00
|
|
|
S_PlayActorSound(404, clip.actor());
|
2020-11-05 06:30:56 +00:00
|
|
|
else
|
2022-12-12 16:51:02 +00:00
|
|
|
CallPlayFTASound(clip.actor());
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorStat(clip.actor(), 1);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2020-11-05 06:30:56 +00:00
|
|
|
}
|
2022-11-21 20:33:27 +00:00
|
|
|
CallOnTouch(clip.actor(), p);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (p->jetpack_on == 0)
|
|
|
|
{
|
2022-09-14 16:19:05 +00:00
|
|
|
if (pact->vel.X > 1)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground && (!isRRRA() || !p->sea_sick_stat))
|
|
|
|
{
|
|
|
|
p->pycount += 52;
|
|
|
|
p->pycount &= 2047;
|
2022-09-14 17:30:20 +00:00
|
|
|
const double factor = 1024. / 1596; // What is 1596?
|
|
|
|
p->pyoff = abs(pact->vel.X * BobVal(p->pycount)) * factor;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (psectlotag != ST_2_UNDERWATER && psectlotag != 1 && (!isRRRA() || !p->sea_sick_stat))
|
|
|
|
p->pyoff = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// RBG***
|
2023-03-16 11:15:11 +00:00
|
|
|
SetActor(pact, pact->spr.pos);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
if (psectlotag == 800 && (!isRRRA() || !p->lotag800kill))
|
|
|
|
{
|
|
|
|
if (isRRRA()) p->lotag800kill = 1;
|
|
|
|
quickkill(p);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (psectlotag < 3)
|
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
psectp = pact->sector();
|
2021-11-18 16:34:31 +00:00
|
|
|
if (ud.clipping == 0 && psectp->lotag == ST_31_TWO_WAY_TRAIN)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-12-05 23:50:33 +00:00
|
|
|
auto act = barrier_cast<DDukeActor*>(psectp->hitagactor);
|
2022-09-03 08:03:30 +00:00
|
|
|
if (act && act->vel.X != 0 && act->temp_data[0] == 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
quickkill(p);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-14 16:19:05 +00:00
|
|
|
if (truefdist < gs.playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && p->insector() && p->cursector->lotag == 1)
|
2020-10-25 07:12:25 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER))
|
2021-11-21 07:56:39 +00:00
|
|
|
if (!isRRRA() || (!p->OnBoat && !p->OnMotorcycle && p->cursector->hitag != 321))
|
2020-10-25 07:12:25 +00:00
|
|
|
S_PlayActorSound(DUKE_ONWATER, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
if (p->cursector != pact->sector())
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorSect(pact, p->cursector);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2023-03-21 10:37:25 +00:00
|
|
|
auto oldpos = p->GetActor()->opos;
|
2022-01-04 23:39:09 +00:00
|
|
|
int retry = 0;
|
|
|
|
while (ud.clipping == 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-01-04 23:39:09 +00:00
|
|
|
int blocked;
|
2022-10-04 17:25:06 +00:00
|
|
|
if (pact->clipdist == 16)
|
2022-11-21 04:20:08 +00:00
|
|
|
blocked = (pushmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, 8, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
|
2020-05-19 07:03:07 +00:00
|
|
|
else
|
2022-11-21 04:20:08 +00:00
|
|
|
blocked = (pushmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, 1, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2022-02-03 23:55:12 +00:00
|
|
|
if (fabs(pact->floorz - pact->ceilingz) < 48 || blocked)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
if (!(pact->sector()->lotag & 0x8000) && (isanunderoperator(pact->sector()->lotag) ||
|
|
|
|
isanearoperator(pact->sector()->lotag)))
|
|
|
|
fi.activatebysector(pact->sector(), pact);
|
2022-01-04 23:39:09 +00:00
|
|
|
if (blocked)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-01-04 23:39:09 +00:00
|
|
|
if (!retry++)
|
|
|
|
{
|
2022-11-21 02:39:48 +00:00
|
|
|
p->GetActor()->spr.pos = oldpos;
|
2022-11-15 08:27:07 +00:00
|
|
|
p->GetActor()->backuppos();
|
2022-01-04 23:39:09 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
quickkill(p);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2022-09-14 16:19:05 +00:00
|
|
|
else if (abs(floorz - ceilingz) < 32 && isanunderoperator(psectp->lotag))
|
2021-11-18 17:51:19 +00:00
|
|
|
fi.activatebysector(psectp, pact);
|
2022-01-04 23:39:09 +00:00
|
|
|
break;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
2022-08-28 09:34:54 +00:00
|
|
|
if (ud.clipping == 0 && (!p->cursector || (p->cursector && p->cursector->ceilingz > (p->cursector->floorz - 12))))
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
quickkill(p);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-03-26 01:45:48 +00:00
|
|
|
if (actions & SB_CENTERVIEW || (p->hard_landing && (cl_dukepitchmode & kDukePitchLandingRecenter)))
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
playerCenterView(snum);
|
|
|
|
}
|
2023-03-29 11:20:07 +00:00
|
|
|
else if ((actions & SB_LOOK_UP) == SB_LOOK_UP)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-08-28 22:57:07 +00:00
|
|
|
playerLookUp(snum, actions);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2023-03-29 11:20:07 +00:00
|
|
|
else if ((actions & SB_LOOK_DOWN) == SB_LOOK_DOWN)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-08-28 22:57:07 +00:00
|
|
|
playerLookDown(snum, actions);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2023-03-29 11:20:07 +00:00
|
|
|
else if ((actions & SB_LOOK_UP) == SB_AIM_UP && !p->OnMotorcycle)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-08-28 22:57:07 +00:00
|
|
|
playerAimUp(snum, actions);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2023-03-29 11:20:07 +00:00
|
|
|
else if ((actions & SB_LOOK_DOWN) == SB_AIM_DOWN && !p->OnMotorcycle)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-08-28 22:57:07 +00:00
|
|
|
playerAimDown(snum, actions);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
if (p->recoil && p->kickback_pic == 0)
|
|
|
|
{
|
2021-11-07 13:36:39 +00:00
|
|
|
int d = p->recoil >> 1;
|
2020-05-19 07:03:07 +00:00
|
|
|
if (!d)
|
|
|
|
d = 1;
|
|
|
|
p->recoil -= d;
|
2022-12-04 10:43:44 +00:00
|
|
|
p->GetActor()->spr.Angles.Pitch += maphoriz(d);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2020-08-05 07:53:22 +00:00
|
|
|
|
2023-03-18 22:08:24 +00:00
|
|
|
if (SyncInput())
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2022-12-09 07:09:59 +00:00
|
|
|
p->GetActor()->spr.Angles.Pitch += GetPlayerHorizon(snum);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
2023-03-26 05:40:25 +00:00
|
|
|
p->Angles.doPitchKeys(&p->sync);
|
|
|
|
|
2023-04-02 09:17:43 +00:00
|
|
|
p->checkhardlanding();
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
//Shooting code/changes
|
|
|
|
|
|
|
|
if (p->show_empty_weapon > 0)
|
2022-11-13 18:47:10 +00:00
|
|
|
{
|
2020-05-19 07:03:07 +00:00
|
|
|
p->show_empty_weapon--;
|
|
|
|
|
2022-11-13 18:47:10 +00:00
|
|
|
if (p->show_empty_weapon == 0 && (WeaponSwitch(p - ps) & 2))
|
|
|
|
{
|
|
|
|
fi.addweapon(p, p->last_full_weapon, true);
|
|
|
|
return;
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2022-11-30 13:29:34 +00:00
|
|
|
dokneeattack(snum);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (fi.doincrements(p)) return;
|
|
|
|
|
|
|
|
if (p->weapon_pos != 0)
|
|
|
|
{
|
|
|
|
if (p->weapon_pos == -9)
|
|
|
|
{
|
|
|
|
if (p->last_weapon >= 0)
|
|
|
|
{
|
2020-09-16 11:01:09 +00:00
|
|
|
p->oweapon_pos = p->weapon_pos = 10;
|
2021-11-09 23:05:42 +00:00
|
|
|
// if(p->curr_weapon == KNEE_WEAPON) p->kickback_pic = 1;
|
2020-05-19 07:03:07 +00:00
|
|
|
p->last_weapon = -1;
|
|
|
|
}
|
|
|
|
else if (p->holster_weapon == 0)
|
2020-09-16 11:01:09 +00:00
|
|
|
p->oweapon_pos = p->weapon_pos = 10;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else p->weapon_pos--;
|
|
|
|
}
|
|
|
|
|
2021-11-18 19:17:47 +00:00
|
|
|
processweapon(snum, actions, psectp);
|
2020-05-19 07:54:52 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-05-22 06:56:42 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-12-03 17:43:15 +00:00
|
|
|
void OnMotorcycle(player_struct *p)
|
2020-05-22 06:56:42 +00:00
|
|
|
{
|
2022-12-03 17:43:15 +00:00
|
|
|
if (!p->OnMotorcycle && p->cursector->lotag != ST_2_UNDERWATER)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
|
|
|
p->over_shoulder_on = 0;
|
|
|
|
p->OnMotorcycle = 1;
|
|
|
|
p->last_full_weapon = p->curr_weapon;
|
|
|
|
p->curr_weapon = MOTORCYCLE_WEAPON;
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[MOTORCYCLE_WEAPON] = true;
|
2022-09-11 22:18:56 +00:00
|
|
|
p->vel.X = 0;
|
|
|
|
p->vel.Y = 0;
|
2022-12-03 03:53:53 +00:00
|
|
|
p->GetActor()->spr.Angles.Pitch = nullAngle;
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-10-27 05:50:06 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(p->GetActor(),186))
|
|
|
|
S_PlayActorSound(186, p->GetActor());
|
2020-05-22 06:56:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-02-07 10:04:19 +00:00
|
|
|
void OffMotorcycle(player_struct *p)
|
2020-05-22 06:56:42 +00:00
|
|
|
{
|
2020-11-02 19:24:07 +00:00
|
|
|
auto pact = p->GetActor();
|
2020-07-20 21:21:27 +00:00
|
|
|
if (p->OnMotorcycle)
|
|
|
|
{
|
2020-11-02 19:24:07 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact,188))
|
|
|
|
S_StopSound(188,pact);
|
|
|
|
if (S_CheckActorSoundPlaying(pact,187))
|
|
|
|
S_StopSound(187,pact);
|
|
|
|
if (S_CheckActorSoundPlaying(pact,186))
|
|
|
|
S_StopSound(186,pact);
|
|
|
|
if (S_CheckActorSoundPlaying(pact,214))
|
|
|
|
S_StopSound(214,pact);
|
|
|
|
if (!S_CheckActorSoundPlaying(pact,42))
|
|
|
|
S_PlayActorSound(42, pact);
|
2020-07-20 21:21:27 +00:00
|
|
|
p->OnMotorcycle = 0;
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[MOTORCYCLE_WEAPON] = false;
|
2020-07-20 21:21:27 +00:00
|
|
|
p->curr_weapon = p->last_full_weapon;
|
|
|
|
checkavailweapon(p);
|
2022-12-03 03:53:53 +00:00
|
|
|
p->GetActor()->spr.Angles.Pitch = nullAngle;
|
2020-07-20 21:21:27 +00:00
|
|
|
p->moto_do_bump = 0;
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->TiltStatus = 0;
|
|
|
|
p->moto_drink = 0;
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->VBumpNow = 0;
|
|
|
|
p->TurbCount = 0;
|
2022-11-25 11:30:40 +00:00
|
|
|
p->vel.XY() = p->GetActor()->spr.Angles.Yaw.ToVector() / 2048.;
|
2020-07-20 21:21:27 +00:00
|
|
|
p->moto_underwater = 0;
|
2022-12-04 13:16:44 +00:00
|
|
|
auto spawned = spawn(p->GetActor(), RTILE_EMPTYBIKE);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (spawned)
|
|
|
|
{
|
2022-11-27 00:13:43 +00:00
|
|
|
spawned->spr.Angles.Yaw = p->GetActor()->spr.Angles.Yaw;
|
2021-11-19 11:32:12 +00:00
|
|
|
spawned->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON];
|
|
|
|
}
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-05-22 06:56:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-12-03 17:43:15 +00:00
|
|
|
void OnBoat(player_struct *p)
|
2020-05-22 06:56:42 +00:00
|
|
|
{
|
2020-07-20 21:21:27 +00:00
|
|
|
if (!p->OnBoat)
|
|
|
|
{
|
|
|
|
p->over_shoulder_on = 0;
|
|
|
|
p->OnBoat = 1;
|
|
|
|
p->last_full_weapon = p->curr_weapon;
|
|
|
|
p->curr_weapon = BOAT_WEAPON;
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[BOAT_WEAPON] = true;
|
2022-09-11 22:18:56 +00:00
|
|
|
p->vel.X = 0;
|
|
|
|
p->vel.Y = 0;
|
2022-12-03 03:53:53 +00:00
|
|
|
p->GetActor()->spr.Angles.Pitch = nullAngle;
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-05-22 06:56:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-02-07 10:04:19 +00:00
|
|
|
void OffBoat(player_struct *p)
|
2020-05-22 06:56:42 +00:00
|
|
|
{
|
2020-07-20 21:21:27 +00:00
|
|
|
if (p->OnBoat)
|
|
|
|
{
|
|
|
|
p->OnBoat = 0;
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[BOAT_WEAPON] = false;
|
2020-07-20 21:21:27 +00:00
|
|
|
p->curr_weapon = p->last_full_weapon;
|
|
|
|
checkavailweapon(p);
|
2022-12-03 03:53:53 +00:00
|
|
|
p->GetActor()->spr.Angles.Pitch = nullAngle;
|
2020-05-22 06:56:42 +00:00
|
|
|
p->moto_do_bump = 0;
|
|
|
|
p->MotoSpeed = 0;
|
2020-07-20 21:21:27 +00:00
|
|
|
p->TiltStatus = 0;
|
|
|
|
p->moto_drink = 0;
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->VBumpNow = 0;
|
|
|
|
p->TurbCount = 0;
|
2022-11-25 11:30:40 +00:00
|
|
|
p->vel.XY() = p->GetActor()->spr.Angles.Yaw.ToVector() / 2048.;
|
2020-07-20 21:21:27 +00:00
|
|
|
p->moto_underwater = 0;
|
2022-12-04 13:16:44 +00:00
|
|
|
auto spawned = spawn(p->GetActor(), RTILE_EMPTYBOAT);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (spawned)
|
|
|
|
{
|
2022-11-27 00:13:43 +00:00
|
|
|
spawned->spr.Angles.Yaw = p->GetActor()->spr.Angles.Yaw;
|
2021-11-19 11:32:12 +00:00
|
|
|
spawned->saved_ammo = p->ammo_amount[BOAT_WEAPON];
|
|
|
|
}
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-05-22 06:56:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-14 10:14:03 +00:00
|
|
|
END_DUKE_NS
|