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
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void incur_damage_r(struct player_struct* p)
|
|
|
|
{
|
2020-10-02 20:14:20 +00:00
|
|
|
int damage = 0, unk = 0, shield_damage = 0;
|
2021-11-07 13:36:39 +00:00
|
|
|
int gut = 0;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
p->GetActor()->s->extra -= p->extra_extra8 >> 8;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
damage = p->GetActor()->s->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-04-15 17:21:43 +00:00
|
|
|
p->GetActor()->s->extra = p->last_extra + damage;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-24 04:58:52 +00:00
|
|
|
static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, int atwith)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spritetype* const s = actor->s;
|
2020-10-20 23:03:38 +00:00
|
|
|
int sect = s->sectnum;
|
|
|
|
int zvel;
|
2021-11-07 09:18:06 +00:00
|
|
|
int hitsect, hitwall;
|
2020-10-20 23:03:38 +00:00
|
|
|
int hitx, hity, hitz;
|
2020-10-23 21:18:05 +00:00
|
|
|
DDukeActor* hitsprt;
|
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
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
zvel = -ps[p].horizon.sum().asq16() >> 11;
|
|
|
|
sz += (6 << 8);
|
|
|
|
sa += 15;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
int x;
|
2020-11-02 22:10:19 +00:00
|
|
|
auto pspr = ps[findplayer(actor, &x)].GetActor();
|
2021-04-15 17:21:43 +00:00
|
|
|
zvel = ((pspr->s->z - sz) << 8) / (x + 1);
|
|
|
|
sa = getangle(pspr->s->x - sx, pspr->s->y - sy);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
hitscan(sx, sy, sz, sect,
|
2020-11-15 11:07:30 +00:00
|
|
|
bcos(sa),
|
|
|
|
bsin(sa), zvel << 6,
|
2020-10-23 21:18:05 +00:00
|
|
|
&hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
2020-09-17 21:02:52 +00:00
|
|
|
|
2021-07-25 01:00:35 +00:00
|
|
|
if (isRRRA() && hitsect >= 0 && ((sector[hitsect].lotag == 160 && zvel > 0) || (sector[hitsect].lotag == 161 && zvel < 0))
|
2020-10-23 21:18:05 +00:00
|
|
|
&& hitsprt == nullptr && hitwall == -1)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-11-12 18:12:30 +00:00
|
|
|
DukeLinearSpriteIterator its;
|
2020-10-24 04:58:52 +00:00
|
|
|
while (auto effector = its.Next())
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2020-10-24 04:58:52 +00:00
|
|
|
// shouldn't this only check STAT_EFFECTOR?
|
2021-04-15 17:21:43 +00:00
|
|
|
if (effector->s->sectnum == hitsect && effector->s->picnum == SECTOREFFECTOR && effector->GetOwner()
|
|
|
|
&& effector->s->lotag == 7)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
|
|
|
int nx, ny, nz;
|
2021-04-15 17:21:43 +00:00
|
|
|
nx = hitx + (effector->GetOwner()->s->x - effector->s->x);
|
|
|
|
ny = hity + (effector->GetOwner()->s->y - effector->s->y);
|
2020-10-20 23:03:38 +00:00
|
|
|
if (sector[hitsect].lotag == 161)
|
|
|
|
{
|
2021-11-06 12:47:06 +00:00
|
|
|
nz = effector->GetOwner()->getSector()->floorz;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-06 12:47:06 +00:00
|
|
|
nz = effector->GetOwner()->getSector()->ceilingz;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
hitscan(nx, ny, nz, effector->GetOwner()->s->sectnum, bcos(sa), bsin(sa), zvel << 6,
|
2020-10-23 21:18:05 +00:00
|
|
|
&hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, 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
|
|
|
if (hitsect < 0) return;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if ((abs(sx - hitx) + abs(sy - hity)) < 1024)
|
|
|
|
{
|
2020-10-23 21:18:05 +00:00
|
|
|
if (hitwall >= 0 || hitsprt)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-24 04:58:52 +00:00
|
|
|
DDukeActor* wpn;
|
2020-10-20 23:03:38 +00:00
|
|
|
if (isRRRA() && atwith == SLINGBLADE)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-24 04:58:52 +00:00
|
|
|
wpn = EGS(hitsect, hitx, hity, hitz, SLINGBLADE, -15, 0, 0, sa, 32, 0, actor, 4);
|
2021-04-15 17:21:43 +00:00
|
|
|
wpn->s->extra += 50;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-24 04:58:52 +00:00
|
|
|
wpn = EGS(hitsect, hitx, hity, hitz, KNEE, -15, 0, 0, sa, 32, 0, actor, 4);
|
2021-04-15 17:21:43 +00:00
|
|
|
wpn->s->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
|
|
|
{
|
2020-10-24 04:58:52 +00:00
|
|
|
auto k = spawn(wpn, SMALLSMOKE);
|
2021-04-15 17:21:43 +00:00
|
|
|
k->s->z -= (8 << 8);
|
2020-10-24 04:58:52 +00:00
|
|
|
if (atwith == KNEE) S_PlayActorSound(KICK_HIT, wpn);
|
|
|
|
else if (isRRRA() && atwith == 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-04-15 17:21:43 +00:00
|
|
|
wpn->s->extra += (gs.max_player_health >> 2);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
if (hitsprt && hitsprt->s->picnum != ACCESSSWITCH && hitsprt->s->picnum != ACCESSSWITCH2)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-24 05:15:10 +00:00
|
|
|
fi.checkhitsprite(hitsprt, wpn);
|
2020-10-26 06:30:34 +00:00
|
|
|
if (p >= 0) fi.checkhitswitch(p, -1, hitsprt);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
else if (hitwall >= 0)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
if (wall[hitwall].cstat & 2)
|
|
|
|
if (wall[hitwall].nextsector >= 0)
|
|
|
|
if (hitz >= (sector[wall[hitwall].nextsector].floorz))
|
|
|
|
hitwall = wall[hitwall].nextwall;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2)
|
|
|
|
{
|
2020-10-24 05:22:44 +00:00
|
|
|
fi.checkhitwall(wpn, hitwall, hitx, hity, hitz, atwith);
|
2020-10-26 06:30:34 +00:00
|
|
|
if (p >= 0) fi.checkhitswitch(p, hitwall, nullptr);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1)
|
|
|
|
{
|
2020-10-24 04:58:52 +00:00
|
|
|
auto splash = spawn(ps[p].GetActor(), WATERSPLASH2);
|
2021-04-15 17:21:43 +00:00
|
|
|
splash->s->x = hitx;
|
|
|
|
splash->s->y = hity;
|
|
|
|
splash->s->ang = ps[p].angle.ang.asbuild(); // Total tweek
|
|
|
|
splash->s->xvel = 32;
|
2020-10-24 04:58:52 +00:00
|
|
|
ssp(actor, 0);
|
2021-04-15 17:21:43 +00:00
|
|
|
splash->s->xvel = 0;
|
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
|
|
|
|
2020-10-24 05:01:01 +00:00
|
|
|
static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-10-20 23:03:38 +00:00
|
|
|
int sect = s->sectnum;
|
|
|
|
int zvel;
|
2021-11-07 09:18:06 +00:00
|
|
|
int hitsect, hitwall;
|
2020-10-20 23:03:38 +00:00
|
|
|
int hitx, hity, hitz;
|
2020-10-23 21:18:05 +00:00
|
|
|
DDukeActor* hitsprt;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (s->extra >= 0) s->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
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (5 << 8);
|
|
|
|
zvel = ((aimed->s->z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed);
|
|
|
|
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
|
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 (atwith == SHOTSPARK1)
|
|
|
|
{
|
2020-11-01 19:57:02 +00:00
|
|
|
if (aimed == nullptr)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
sa += 16 - (krand() & 31);
|
|
|
|
zvel = -ps[p].horizon.sum().asq16() >> 11;
|
2020-05-16 21:55:21 +00:00
|
|
|
zvel += 128 - (krand() & 255);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
if (atwith == SHOTGUN)
|
|
|
|
sa += 64 - (krand() & 127);
|
2020-05-16 21:55:21 +00:00
|
|
|
else
|
2020-10-20 23:03:38 +00:00
|
|
|
sa += 16 - (krand() & 31);
|
2020-11-01 19:57:02 +00:00
|
|
|
if (aimed == nullptr) zvel = -ps[p].horizon.sum().asq16() >> 11;
|
2020-10-20 23:03:38 +00:00
|
|
|
zvel += 128 - (krand() & 255);
|
|
|
|
}
|
|
|
|
sz -= (2 << 8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int x;
|
2020-11-01 19:57:02 +00:00
|
|
|
int j = findplayer(actor, &x);
|
2020-10-20 23:03:38 +00:00
|
|
|
sz -= (4 << 8);
|
2021-10-31 06:52:52 +00:00
|
|
|
zvel = ((ps[j].pos.z - sz) << 8) / (ldist(ps[j].GetActor(), actor));
|
2020-10-20 23:03:38 +00:00
|
|
|
if (s->picnum != BOSS1)
|
|
|
|
{
|
|
|
|
zvel += 128 - (krand() & 255);
|
|
|
|
sa += 32 - (krand() & 63);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
zvel += 128 - (krand() & 255);
|
2021-10-31 06:52:52 +00:00
|
|
|
sa = getangle(ps[j].pos.x - sx, ps[j].pos.y - sy) + 64 - (krand() & 127);
|
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
|
|
|
s->cstat &= ~257;
|
2020-11-15 11:07:30 +00:00
|
|
|
hitscan(sx, sy, sz, sect, bcos(sa), bsin(sa),
|
2020-10-23 21:18:05 +00:00
|
|
|
zvel << 6, &hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-07-25 01:00:35 +00:00
|
|
|
if (isRRRA() && hitsect >= 0 && (((sector[hitsect].lotag == 160 && zvel > 0) || (sector[hitsect].lotag == 161 && zvel < 0))
|
2020-10-23 21:18:05 +00:00
|
|
|
&& hitsprt == nullptr && hitwall == -1))
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2020-11-12 18:12:30 +00:00
|
|
|
DukeLinearSpriteIterator its;
|
2020-10-24 05:01:01 +00:00
|
|
|
while (auto effector = its.Next())
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-24 05:01:01 +00:00
|
|
|
// shouldn't this only check STAT_EFFECTOR?
|
2021-04-15 17:21:43 +00:00
|
|
|
if (effector->s->sectnum == hitsect && effector->s->picnum == SECTOREFFECTOR && effector->GetOwner()
|
|
|
|
&& effector->s->lotag == 7)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
int nx, ny, nz;
|
2021-04-15 17:21:43 +00:00
|
|
|
nx = hitx + (effector->GetOwner()->s->x - effector->s->x);
|
|
|
|
ny = hity + (effector->GetOwner()->s->y - effector->s->y);
|
2020-10-20 23:03:38 +00:00
|
|
|
if (sector[hitsect].lotag == 161)
|
|
|
|
{
|
2021-11-06 12:47:06 +00:00
|
|
|
nz = effector->GetOwner()->getSector()->floorz;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-11-06 12:47:06 +00:00
|
|
|
nz = effector->GetOwner()->getSector()->ceilingz;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
hitscan(nx, ny, nz, effector->GetOwner()->s->sectnum, bcos(sa), bsin(sa), zvel << 6,
|
2020-10-23 21:18:05 +00:00
|
|
|
&hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, 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
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
s->cstat |= 257;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (hitsect < 0) return;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (atwith == SHOTGUN)
|
|
|
|
if (sector[hitsect].lotag == 1)
|
|
|
|
if (krand() & 1)
|
|
|
|
return;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if ((krand() & 15) == 0 && sector[hitsect].lotag == 2)
|
|
|
|
tracers(hitx, hity, hitz, sx, sy, sz, 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)
|
|
|
|
{
|
2020-10-24 05:01:01 +00:00
|
|
|
spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, actor, 4);
|
2021-04-15 17:21:43 +00:00
|
|
|
spark->s->extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
|
|
|
|
spark->s->extra += (krand() % 6);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-23 21:18:05 +00:00
|
|
|
if (hitwall == -1 && hitsprt == nullptr)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
|
|
|
if (zvel < 0)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
if (sector[hitsect].ceilingstat & 1)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spark->s->xrepeat = 0;
|
|
|
|
spark->s->yrepeat = 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
|
|
|
|
fi.checkhitceiling(hitsect);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
if (sector[hitsect].lotag != 1)
|
2020-10-24 05:01:01 +00:00
|
|
|
spawn(spark, SMALLSMOKE);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-23 21:18:05 +00:00
|
|
|
if (hitsprt)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (hitsprt->s->picnum == 1930)
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
2020-10-24 05:15:10 +00:00
|
|
|
fi.checkhitsprite(hitsprt, spark);
|
2021-04-15 17:21:43 +00:00
|
|
|
if (hitsprt->s->picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-24 05:01:01 +00:00
|
|
|
auto l = spawn(spark, JIBS6);
|
2021-04-15 17:21:43 +00:00
|
|
|
spark->s->xrepeat = spark->s->yrepeat = 0;
|
|
|
|
l->s->z += (4 << 8);
|
|
|
|
l->s->xvel = 16;
|
|
|
|
l->s->xrepeat = l->s->yrepeat = 24;
|
|
|
|
l->s->ang += 64 - (krand() & 127);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-24 05:01:01 +00:00
|
|
|
else spawn(spark, SMALLSMOKE);
|
2020-10-20 23:03:38 +00:00
|
|
|
|
|
|
|
if (p >= 0 && (
|
2021-04-15 17:21:43 +00:00
|
|
|
hitsprt->s->picnum == DIPSWITCH ||
|
|
|
|
hitsprt->s->picnum == DIPSWITCH + 1 ||
|
|
|
|
hitsprt->s->picnum == DIPSWITCH2 ||
|
|
|
|
hitsprt->s->picnum == DIPSWITCH2 + 1 ||
|
|
|
|
hitsprt->s->picnum == DIPSWITCH3 ||
|
|
|
|
hitsprt->s->picnum == DIPSWITCH3 + 1 ||
|
|
|
|
(isRRRA() && hitsprt->s->picnum == RRTILE8660) ||
|
|
|
|
hitsprt->s->picnum == HANDSWITCH ||
|
|
|
|
hitsprt->s->picnum == HANDSWITCH + 1))
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-26 06:30:34 +00:00
|
|
|
fi.checkhitswitch(p, -1, hitsprt);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (hitwall >= 0)
|
|
|
|
{
|
2020-10-24 05:01:01 +00:00
|
|
|
spawn(spark, SMALLSMOKE);
|
2021-11-06 12:20:51 +00:00
|
|
|
auto wal = &wall[hitwall];
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-06 12:20:51 +00:00
|
|
|
if (fi.isadoorwall(wal->picnum) == 1)
|
2020-10-20 23:03:38 +00:00
|
|
|
goto SKIPBULLETHOLE;
|
2021-11-06 12:20:51 +00:00
|
|
|
if (isablockdoor(wal->picnum) == 1)
|
2020-10-20 23:03:38 +00:00
|
|
|
goto SKIPBULLETHOLE;
|
|
|
|
if (p >= 0 && (
|
2021-11-06 12:20:51 +00:00
|
|
|
wal->picnum == DIPSWITCH ||
|
|
|
|
wal->picnum == DIPSWITCH + 1 ||
|
|
|
|
wal->picnum == DIPSWITCH2 ||
|
|
|
|
wal->picnum == DIPSWITCH2 + 1 ||
|
|
|
|
wal->picnum == DIPSWITCH3 ||
|
|
|
|
wal->picnum == DIPSWITCH3 + 1 ||
|
|
|
|
(isRRRA() && wal->picnum == RRTILE8660) ||
|
|
|
|
wal->picnum == HANDSWITCH ||
|
|
|
|
wal->picnum == HANDSWITCH + 1))
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2020-10-26 06:30:34 +00:00
|
|
|
fi.checkhitswitch(p, hitwall, nullptr);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-07 07:46:15 +00:00
|
|
|
if (wal->hitag != 0 || (wal->nextwall >= 0 && wal->nextWall()->hitag != 0))
|
2020-10-20 23:03:38 +00:00
|
|
|
goto SKIPBULLETHOLE;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (hitsect >= 0 && sector[hitsect].lotag == 0)
|
2021-11-06 12:20:51 +00:00
|
|
|
if (wal->overpicnum != BIGFORCE)
|
2021-11-07 07:26:06 +00:00
|
|
|
if ((wal->nextsector >= 0 && wal->nextSector()->lotag == 0) ||
|
2021-11-06 12:20:51 +00:00
|
|
|
(wal->nextsector == -1 && sector[hitsect].lotag == 0))
|
|
|
|
if ((wal->cstat & 16) == 0)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-11-06 12:20:51 +00:00
|
|
|
if (wal->nextsector >= 0)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-11-06 12:20:51 +00:00
|
|
|
DukeSectIterator it(wal->nextsector);
|
2020-10-24 05:01:01 +00:00
|
|
|
while (auto l = it.Next())
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (l->s->statnum == 3 && l->s->lotag == 13)
|
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
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (l->s->picnum == BULLETHOLE)
|
2020-10-24 05:01:01 +00:00
|
|
|
if (dist(l, spark) < (12 + (krand() & 7)))
|
2020-10-20 23:03:38 +00:00
|
|
|
goto SKIPBULLETHOLE;
|
|
|
|
}
|
2020-10-24 05:01:01 +00:00
|
|
|
auto l = spawn(spark, BULLETHOLE);
|
2021-04-15 17:21:43 +00:00
|
|
|
l->s->xvel = -1;
|
2021-11-06 12:20:51 +00:00
|
|
|
l->s->ang = getangle(wal->x - wall[wal->point2].x,
|
|
|
|
wal->y - wall[wal->point2].y) + 512;
|
2020-10-20 23:03:38 +00:00
|
|
|
ssp(l, CLIPMASK0);
|
|
|
|
}
|
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-11-06 12:20:51 +00:00
|
|
|
if (wal->cstat & 2)
|
|
|
|
if (wal->nextsector >= 0)
|
2021-11-07 07:26:06 +00:00
|
|
|
if (hitz >= (wal->nextSector()->floorz))
|
2021-11-06 12:20:51 +00:00
|
|
|
hitwall = wal->nextwall;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-24 05:22:44 +00:00
|
|
|
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-24 05:01:01 +00:00
|
|
|
spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, actor, 4);
|
2021-04-15 17:21:43 +00:00
|
|
|
spark->s->extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-23 21:18:05 +00:00
|
|
|
if (hitsprt)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-24 05:15:10 +00:00
|
|
|
fi.checkhitsprite(hitsprt, spark);
|
2021-04-15 17:21:43 +00:00
|
|
|
if (hitsprt->s->picnum != TILE_APLAYER)
|
2020-10-24 05:01:01 +00:00
|
|
|
spawn(spark, SMALLSMOKE);
|
2021-04-15 17:21:43 +00:00
|
|
|
else spark->s->xrepeat = spark->s->yrepeat = 0;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
else if (hitwall >= 0)
|
2020-10-24 05:22:44 +00:00
|
|
|
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
|
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)
|
|
|
|
{
|
|
|
|
vec3_t v{ hitx, hity, hitz };
|
2020-10-24 05:01:01 +00:00
|
|
|
S_PlaySound3D(PISTOL_RICOCHET, spark, &v);
|
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
|
|
|
|
2020-10-25 05:09:33 +00:00
|
|
|
static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-10-20 23:03:38 +00:00
|
|
|
int sect = s->sectnum;
|
|
|
|
int vel, 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())
|
|
|
|
{
|
|
|
|
if (atwith != SPIT && s->extra >= 0) s->shade = -96;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
scount = 1;
|
|
|
|
if (atwith == SPIT)
|
|
|
|
{
|
|
|
|
if (s->picnum == 8705)
|
|
|
|
vel = 600;
|
|
|
|
else
|
|
|
|
vel = 400;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-16 21:55:21 +00:00
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
|
|
|
|
scount = 1;
|
2020-10-20 23:03:38 +00:00
|
|
|
if (atwith == SPIT) vel = 400;
|
|
|
|
}
|
|
|
|
if (atwith != SPIT)
|
|
|
|
{
|
|
|
|
vel = 840;
|
|
|
|
sz -= (4 << 7);
|
|
|
|
if (s->picnum == 4649)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-11-15 11:07:30 +00:00
|
|
|
sx += bcos(s->ang + 256, -6);
|
|
|
|
sy += bsin(s->ang + 256, -6);
|
2020-10-20 23:03:38 +00:00
|
|
|
sz += (12 << 8);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
if (s->picnum == VIXEN)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
sz -= (12 << 8);
|
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
|
|
|
|
2020-11-15 11:07:30 +00:00
|
|
|
sx += bcos(s->ang + 160, -7);
|
|
|
|
sy += bsin(s->ang + 160, -7);
|
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
if (aimed)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) - (12 << 8);
|
|
|
|
zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
|
|
|
|
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-04 11:36:54 +00:00
|
|
|
zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int x;
|
2020-11-02 22:10:19 +00:00
|
|
|
int j = findplayer(actor, &x);
|
2020-10-20 23:03:38 +00:00
|
|
|
// sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy);
|
|
|
|
if (s->picnum == HULK)
|
|
|
|
sa -= (krand() & 31);
|
|
|
|
else if (s->picnum == VIXEN)
|
|
|
|
sa -= (krand() & 16);
|
|
|
|
else if (s->picnum != UFOBEAM)
|
|
|
|
sa += 16 - (krand() & 31);
|
|
|
|
|
2020-10-25 05:09:33 +00:00
|
|
|
zvel = (((ps[j].oposz - sz + (3 << 8))) * vel) / ldist(ps[j].GetActor(), actor);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
int oldzvel = zvel;
|
|
|
|
int sizx, sizy;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (atwith == SPIT)
|
|
|
|
{
|
|
|
|
sizx = 18; sizy = 18;
|
|
|
|
if (!isRRRA() || s->picnum != MAMA) sz -= (10 << 8); else sz -= (20 << 8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (atwith == COOLEXPLOSION1)
|
|
|
|
{
|
|
|
|
sizx = 8;
|
|
|
|
sizy = 8;
|
|
|
|
}
|
|
|
|
else if (atwith == FIRELASER)
|
|
|
|
{
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
sizx = 34;
|
|
|
|
sizy = 34;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sizx = 18;
|
|
|
|
sizy = 18;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
sizx = 18;
|
|
|
|
sizy = 18;
|
|
|
|
}
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (p >= 0) sizx = 7, sizy = 7;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
while (scount > 0)
|
|
|
|
{
|
2020-10-25 05:09:33 +00:00
|
|
|
auto j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4);
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->extra += (krand() & 7);
|
|
|
|
j->s->cstat = 128;
|
|
|
|
j->s->clipdist = 4;
|
2020-10-20 23:03:38 +00:00
|
|
|
|
|
|
|
sa = s->ang + 32 - (krand() & 63);
|
|
|
|
zvel = oldzvel + 512 - (krand() & 1023);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (atwith == FIRELASER)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->xrepeat = 8;
|
|
|
|
j->s->yrepeat = 8;
|
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
|
|
|
|
2020-10-25 05:10:10 +00:00
|
|
|
static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-10-20 23:03:38 +00:00
|
|
|
int sect = s->sectnum;
|
|
|
|
int vel, zvel;
|
2021-11-07 13:36:39 +00:00
|
|
|
int l, scount;
|
2020-10-20 23:03:38 +00:00
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
DDukeActor* act90 = nullptr;
|
2020-10-20 23:03:38 +00:00
|
|
|
if (s->extra >= 0) s->shade = -96;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
scount = 1;
|
|
|
|
vel = 644;
|
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
DDukeActor* aimed = nullptr;
|
2020-10-20 23:03:38 +00:00
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
2020-11-01 19:57:02 +00:00
|
|
|
aimed = aim(actor, 48);
|
|
|
|
if (aimed)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
|
|
|
if (isRRRA() && atwith == RPG2)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (aimed->s->picnum == HEN || aimed->s->picnum == HENSTAYPUT)
|
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
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (8 << 8);
|
|
|
|
zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
|
|
|
|
if (aimed->s->picnum != RECON)
|
|
|
|
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2021-01-04 11:36:54 +00:00
|
|
|
else zvel = -MulScale(ps[p].horizon.sum().asq16(), 81, 16);
|
2020-10-20 23:03:38 +00:00
|
|
|
if (atwith == RPG)
|
2020-11-01 19:57:02 +00:00
|
|
|
S_PlayActorSound(RPG_SHOOT, actor);
|
2020-10-20 23:03:38 +00:00
|
|
|
else if (isRRRA())
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
if (atwith == RPG2)
|
2020-11-01 19:57:02 +00:00
|
|
|
S_PlayActorSound(244, actor);
|
2020-10-20 23:03:38 +00:00
|
|
|
else if (atwith == RRTILE1790)
|
2020-11-01 19:57:02 +00:00
|
|
|
S_PlayActorSound(94, actor);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int x;
|
2020-11-02 22:10:19 +00:00
|
|
|
int j = findplayer(actor, &x);
|
2020-10-20 23:03:38 +00:00
|
|
|
sa = getangle(ps[j].oposx - sx, ps[j].oposy - sy);
|
|
|
|
if (s->picnum == BOSS3)
|
|
|
|
sz -= (32 << 8);
|
|
|
|
else if (s->picnum == BOSS2)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
vel += 128;
|
|
|
|
sz += 24 << 8;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
l = ldist(ps[j].GetActor(), actor);
|
2020-10-20 23:03:38 +00:00
|
|
|
zvel = ((ps[j].oposz - sz) * vel) / l;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (badguy(s) && (s->hitag & face_player_smart))
|
|
|
|
sa = s->ang + (krand() & 31) - 16;
|
|
|
|
}
|
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
if (p < 0) aimed = nullptr;
|
2020-10-20 23:03:38 +00:00
|
|
|
|
|
|
|
if (isRRRA() && atwith == RRTILE1790)
|
|
|
|
{
|
|
|
|
zvel = -(10 << 8);
|
|
|
|
vel <<= 1;
|
|
|
|
}
|
|
|
|
|
2020-10-23 19:37:40 +00:00
|
|
|
auto spawned = EGS(sect,
|
2020-11-15 11:07:30 +00:00
|
|
|
sx + (bcos(sa + 348) / 448),
|
|
|
|
sy + (bsin(sa + 348) / 448),
|
2020-10-25 05:10:10 +00:00
|
|
|
sz - (1 << 8), atwith, 0, 14, 14, sa, vel, zvel, actor, 4);
|
2020-10-20 23:03:38 +00:00
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (atwith == RRTILE1790)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->extra = 10;
|
|
|
|
spawned->s->zvel = -(10 << 8);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
else if (atwith == RPG2)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-11-01 19:57:02 +00:00
|
|
|
spawned->seek_actor = act90;
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->hitag = 0;
|
2020-10-23 19:37:40 +00:00
|
|
|
fi.lotsofmoney(spawned, (krand() & 3) + 1);
|
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-04-15 17:21:43 +00:00
|
|
|
spawned->s->extra += (krand() & 7);
|
2020-10-20 23:03:38 +00:00
|
|
|
if (atwith != FREEZEBLAST)
|
2020-11-01 19:57:02 +00:00
|
|
|
spawned->temp_actor = aimed;
|
2020-10-20 23:03:38 +00:00
|
|
|
else
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->yvel = gs.numfreezebounces;
|
|
|
|
spawned->s->xrepeat >>= 1;
|
|
|
|
spawned->s->yrepeat >>= 1;
|
|
|
|
spawned->s->zvel -= (2 << 4);
|
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)
|
|
|
|
{
|
|
|
|
if (s->picnum == HULK)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->xrepeat = 8;
|
|
|
|
spawned->s->yrepeat = 8;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
else if (atwith != FREEZEBLAST)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->xrepeat = 30;
|
|
|
|
spawned->s->yrepeat = 30;
|
|
|
|
spawned->s->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-04-15 17:21:43 +00:00
|
|
|
spawned->s->extra >>= 2;
|
|
|
|
spawned->s->ang += 16 - (krand() & 31);
|
|
|
|
spawned->s->zvel += 256 - (krand() & 511);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (ps[p].hbomb_hold_delay)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->x -= bsin(sa) / 644;
|
|
|
|
spawned->s->y += bcos(sa) / 644;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->x += bsin(sa, -8);
|
|
|
|
spawned->s->y -= bcos(sa, -8);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->xrepeat >>= 1;
|
|
|
|
spawned->s->yrepeat >>= 1;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->cstat = 128;
|
2020-10-20 23:03:38 +00:00
|
|
|
if (atwith == RPG || (atwith == RPG2 && isRRRA()))
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->clipdist = 4;
|
2020-10-20 23:03:38 +00:00
|
|
|
else
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->clipdist = 40;
|
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
|
|
|
|
2020-10-25 05:10:10 +00:00
|
|
|
static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-10-20 23:03:38 +00:00
|
|
|
int sect = s->sectnum;
|
|
|
|
int vel, zvel;
|
2021-11-07 13:36:39 +00:00
|
|
|
int scount;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (s->extra >= 0) s->shade = -96;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
scount = 1;
|
|
|
|
if (atwith == 3471)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-20 23:03:38 +00:00
|
|
|
vel = 300;
|
|
|
|
sz -= (15 << 8);
|
2020-05-16 21:55:21 +00:00
|
|
|
scount = 1;
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else if (atwith == 3475)
|
|
|
|
{
|
|
|
|
vel = 300;
|
|
|
|
sz += (4 << 8);
|
|
|
|
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
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) - (12 << 8);
|
|
|
|
zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
|
|
|
|
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
else
|
2021-01-04 11:36:54 +00:00
|
|
|
zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int x;
|
2020-11-02 22:10:19 +00:00
|
|
|
int j = findplayer(actor, &x);
|
2020-10-20 23:03:38 +00:00
|
|
|
// sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy);
|
|
|
|
if (s->picnum == VIXEN)
|
|
|
|
sa -= (krand() & 16);
|
|
|
|
else
|
|
|
|
sa += 16 - (krand() & 31);
|
2020-11-01 19:57:02 +00:00
|
|
|
zvel = (((ps[j].oposz - sz + (3 << 8))) * vel) / ldist(ps[j].GetActor(), actor);
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
int oldzvel = zvel;
|
|
|
|
int sizx = 18;
|
|
|
|
int sizy = 18;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
if (p >= 0) sizx = 7, sizy = 7;
|
|
|
|
else sizx = 8, sizy = 8;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
while (scount > 0)
|
|
|
|
{
|
2020-10-25 05:10:10 +00:00
|
|
|
auto j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4);
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->extra += (krand() & 7);
|
|
|
|
j->s->cstat = 128;
|
|
|
|
j->s->clipdist = 4;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
sa = s->ang + 32 - (krand() & 63);
|
|
|
|
zvel = oldzvel + 512 - (krand() & 1023);
|
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-10-24 05:34:39 +00:00
|
|
|
void shoot_r(DDukeActor* actor, int atwith)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spritetype* const s = actor->s;
|
2020-10-24 05:34:39 +00:00
|
|
|
|
2021-11-07 13:36:39 +00:00
|
|
|
int sect, sa, p;
|
2020-10-21 05:31:21 +00:00
|
|
|
int sx, sy, sz, vel, zvel, x;
|
2020-10-20 23:03:38 +00:00
|
|
|
|
2020-11-01 17:23:09 +00:00
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
sect = s->sectnum;
|
|
|
|
zvel = 0;
|
|
|
|
|
|
|
|
if (s->picnum == TILE_APLAYER)
|
|
|
|
{
|
|
|
|
p = s->yvel;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
sx = ps[p].pos.x;
|
|
|
|
sy = ps[p].pos.y;
|
|
|
|
sz = ps[p].pos.z + ps[p].pyoff + (4 << 8);
|
2020-10-20 23:03:38 +00:00
|
|
|
sa = ps[p].angle.ang.asbuild();
|
|
|
|
|
|
|
|
if (isRRRA()) ps[p].crack_time = CRACK_TIME;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p = -1;
|
|
|
|
sa = s->ang;
|
|
|
|
sx = s->x;
|
|
|
|
sy = s->y;
|
2020-11-23 07:39:49 +00:00
|
|
|
sz = s->z - ((s->yrepeat * tileHeight(s->picnum)) << 1) + (4 << 8);
|
2020-10-20 23:03:38 +00:00
|
|
|
sz -= (7 << 8);
|
|
|
|
if (badguy(s))
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-11-15 11:07:30 +00:00
|
|
|
sx -= bsin(sa, -7);
|
|
|
|
sy += bcos(sa, -7);
|
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-24 05:28:07 +00:00
|
|
|
SetGameVarID(g_iAtWithVarID, atwith, actor, p);
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, 0, actor, p);
|
|
|
|
OnEvent(EVENT_SHOOT, p, ps[p].GetActor(), -1);
|
|
|
|
if (GetGameVarID(g_iReturnVarID, actor, p) != 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
|
|
|
switch (atwith)
|
|
|
|
{
|
|
|
|
case BLOODSPLAT1:
|
|
|
|
case BLOODSPLAT2:
|
|
|
|
case BLOODSPLAT3:
|
|
|
|
case BLOODSPLAT4:
|
2020-10-23 17:50:18 +00:00
|
|
|
shootbloodsplat(actor, p, sx, sy, sz, sa, atwith, BIGFORCE, OOZFILTER, -1);
|
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
|
|
|
case SLINGBLADE:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
case KNEE:
|
|
|
|
case GROWSPARK:
|
2020-10-24 04:58:52 +00:00
|
|
|
shootmelee(actor, p, sx, sy, sz, sa, atwith);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
case SHOTSPARK1:
|
|
|
|
case SHOTGUN:
|
|
|
|
case CHAINGUN:
|
2020-10-24 05:01:01 +00:00
|
|
|
shootweapon(actor, p, sx, sy, sz, sa, atwith);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
case TRIPBOMBSPRITE:
|
2020-10-24 05:34:39 +00:00
|
|
|
{
|
|
|
|
auto j = spawn(actor, atwith);
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->xvel = 32;
|
|
|
|
j->s->ang = s->ang;
|
|
|
|
j->s->z -= (5 << 8);
|
2020-10-20 23:03:38 +00:00
|
|
|
break;
|
2020-10-24 05:34:39 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
case BOWLINGBALL:
|
2020-10-24 05:34:39 +00:00
|
|
|
{
|
|
|
|
auto j = spawn(actor, atwith);
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->xvel = 250;
|
|
|
|
j->s->ang = s->ang;
|
|
|
|
j->s->z -= (15 << 8);
|
2020-10-20 23:03:38 +00:00
|
|
|
break;
|
2020-10-24 05:34:39 +00:00
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
case OWHIP:
|
|
|
|
case UWHIP:
|
2020-10-25 05:10:10 +00:00
|
|
|
shootwhip(actor, p, sx, sy, sz, sa, atwith);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
case FIRELASER:
|
|
|
|
case SPIT:
|
|
|
|
case COOLEXPLOSION1:
|
2020-10-25 05:09:33 +00:00
|
|
|
shootstuff(actor, p, sx, sy, sz, sa, atwith);
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
case RPG2:
|
|
|
|
case RRTILE1790:
|
|
|
|
if (isRRRA()) goto rrra_rpg2;
|
|
|
|
else break;
|
|
|
|
|
|
|
|
case FREEZEBLAST:
|
|
|
|
sz += (3 << 8);
|
|
|
|
case RPG:
|
|
|
|
case SHRINKSPARK:
|
|
|
|
rrra_rpg2:
|
2020-10-25 05:10:10 +00:00
|
|
|
shootrpg(actor, p, sx, sy, sz, sa, atwith);
|
2020-10-20 23:03:38 +00:00
|
|
|
break;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
|
|
|
case CHEERBOMB:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
case MORTER:
|
2020-10-25 05:14:54 +00:00
|
|
|
{
|
2020-05-16 21:55:21 +00:00
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
|
2020-10-25 05:14:54 +00:00
|
|
|
auto j = ps[findplayer(actor, &x)].GetActor();
|
|
|
|
x = ldist(j, actor);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
|
|
|
zvel = -x >> 1;
|
|
|
|
|
|
|
|
if (zvel < -4096)
|
|
|
|
zvel = -2048;
|
|
|
|
vel = x >> 4;
|
|
|
|
|
|
|
|
if (atwith == CHEERBOMB)
|
|
|
|
EGS(sect,
|
2020-11-15 11:07:30 +00:00
|
|
|
sx - bsin(sa + 512, -8),
|
|
|
|
sy + bcos(sa + 512, -8),
|
2020-10-25 05:14:54 +00:00
|
|
|
sz + (6 << 8), atwith, -64, 16, 16, sa, vel, zvel, actor, 1);
|
2020-05-16 21:55:21 +00:00
|
|
|
else
|
|
|
|
EGS(sect,
|
2020-11-15 11:07:30 +00:00
|
|
|
sx - bsin(sa + 512, -8),
|
|
|
|
sy + bcos(sa + 512, -8),
|
2020-10-25 05:14:54 +00:00
|
|
|
sz + (6 << 8), atwith, -64, 32, 32, sa, vel, zvel, actor, 1);
|
2020-05-16 21:55:21 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-10-25 05:14:54 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
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];
|
2021-04-15 17:21:43 +00:00
|
|
|
if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->s->xrepeat > 8 && 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)
|
|
|
|
{
|
|
|
|
fi.addweapon(p, KNEE_WEAPON);
|
|
|
|
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
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (act->s->picnum == HEAVYHBOMB && 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:
|
|
|
|
fi.addweapon(p, j);
|
|
|
|
break;
|
|
|
|
case SLINGBLADE_WEAPON:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
2020-11-02 19:24:07 +00:00
|
|
|
S_PlayActorSound(496, ps[screenpeek].GetActor());
|
2020-05-17 11:25:39 +00:00
|
|
|
fi.addweapon(p, j);
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
fi.addweapon(p, PISTOL_WEAPON);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CHICKEN_WEAPON:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
fi.addweapon(p, j);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
fi.addweapon(p, j);
|
|
|
|
}
|
|
|
|
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])
|
|
|
|
fi.addweapon(p, DYNAMITE_WEAPON);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-05-17 16:04:45 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
int doincrements_r(struct player_struct* p)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
WindDir = krand() & 2047;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (BellTime > 0)
|
|
|
|
{
|
|
|
|
BellTime--;
|
2020-10-26 06:30:34 +00:00
|
|
|
if (BellTime == 0 && BellSprite)
|
2021-04-15 17:21:43 +00:00
|
|
|
BellSprite->s->picnum++;
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
snum = p->GetActor()->s->yvel;
|
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)
|
|
|
|
{
|
|
|
|
p->noise_radius = 16384;
|
|
|
|
madenoise(screenpeek);
|
2020-11-15 11:07:30 +00:00
|
|
|
p->posxv += p->angle.ang.bcos(4);
|
|
|
|
p->posyv += p->angle.ang.bsin(4);
|
2020-05-17 16:04:45 +00:00
|
|
|
}
|
|
|
|
p->eat -= 4;
|
|
|
|
if (p->eat < 0)
|
|
|
|
p->eat = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->invdisptime > 0)
|
|
|
|
p->invdisptime--;
|
|
|
|
|
|
|
|
if (p->tipincs > 0) p->tipincs--;
|
|
|
|
|
|
|
|
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-04-15 17:21:43 +00:00
|
|
|
if (p->access_incs && p->GetActor()->s->pal != 1)
|
2020-05-17 16:04:45 +00:00
|
|
|
{
|
|
|
|
p->access_incs++;
|
2021-04-15 17:21:43 +00:00
|
|
|
if (p->GetActor()->s->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
|
|
|
{
|
2020-10-26 06:30:34 +00:00
|
|
|
fi.checkhitswitch(snum, -1, p->access_spritenum);
|
2021-04-15 17:21:43 +00:00
|
|
|
switch (p->access_spritenum->s->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
|
|
|
|
{
|
2020-10-26 06:30:34 +00:00
|
|
|
fi.checkhitswitch(snum, p->access_wallnum, nullptr);
|
2020-05-17 16:04:45 +00:00
|
|
|
switch (wall[p->access_wallnum].pal)
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
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-06 20:59:42 +00:00
|
|
|
if (p->scuba_on == 0 && 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
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void checkweapons_r(struct player_struct* p)
|
|
|
|
{
|
2021-11-07 13:09:55 +00:00
|
|
|
static const uint16_t weapon_sprites[MAX_WEAPONS] = { KNEE, FIRSTGUNSPRITE, SHOTGUNSPRITE,
|
2020-05-17 21:44:53 +00:00
|
|
|
CHAINGUNSPRITE, RPGSPRITE, HEAVYHBOMB, SHRINKERSPRITE, DEVISTATORSPRITE,
|
|
|
|
TRIPBOMBSPRITE, BOWLINGBALLSPRITE, FREEZEBLAST, HEAVYHBOMB };
|
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (p->OnMotorcycle && numplayers > 1)
|
|
|
|
{
|
2020-10-25 06:30:47 +00:00
|
|
|
auto j = spawn(p->GetActor(), 7220);
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->ang = p->angle.ang.asbuild();
|
2020-10-28 06:30:17 +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;
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.horiz = q16horiz(0);
|
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-04-15 17:21:43 +00:00
|
|
|
j->s->ang = p->angle.ang.asbuild();
|
2020-10-28 06:30:17 +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;
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.horiz = q16horiz(0);
|
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;
|
|
|
|
case DYNAMITE_WEAPON:
|
|
|
|
case CROSSBOW_WEAPON:
|
2020-10-25 06:30:47 +00:00
|
|
|
spawn(p->GetActor(), 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)
|
|
|
|
{
|
2020-10-25 06:30:47 +00:00
|
|
|
auto j = spawn(p->GetActor(), ACCESSCARD);
|
2020-05-17 21:44:53 +00:00
|
|
|
switch (i)
|
|
|
|
{
|
|
|
|
case 1:
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->lotag = 100;
|
2020-05-17 21:44:53 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->lotag = 101;
|
2020-05-17 21:44:53 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->lotag = 102;
|
2020-05-17 21:44:53 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->lotag = 103;
|
2020-05-17 21:44:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
static void onMotorcycle(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
|
|
|
|
2021-11-07 13:36:39 +00:00
|
|
|
int rng;
|
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
|
|
|
|
2020-11-04 23:07:39 +00:00
|
|
|
if (p->vehForwardScale != 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (p->on_ground)
|
|
|
|
{
|
2021-01-03 08:25:49 +00:00
|
|
|
if (p->MotoSpeed == 0 && p->vehBraking)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, 187))
|
|
|
|
S_PlayActorSound(187, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-10-25 06:42:29 +00:00
|
|
|
else if (p->MotoSpeed == 0 && !S_CheckActorSoundPlaying(pact, 214))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 187))
|
|
|
|
S_StopSound(187, pact);
|
|
|
|
S_PlayActorSound(214, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-10-25 06:42:29 +00:00
|
|
|
else if (p->MotoSpeed >= 50 && !S_CheckActorSoundPlaying(pact, 188))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
S_PlayActorSound(188, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-10-25 06:42:29 +00:00
|
|
|
else if (!S_CheckActorSoundPlaying(pact, 188) && !S_CheckActorSoundPlaying(pact, 214))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
S_PlayActorSound(188, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 214))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
S_StopSound(214, pact);
|
|
|
|
if (!S_CheckActorSoundPlaying(pact, 189))
|
|
|
|
S_PlayActorSound(189, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-10-25 06:42:29 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 188))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
S_StopSound(188, pact);
|
|
|
|
if (!S_CheckActorSoundPlaying(pact, 189))
|
|
|
|
S_PlayActorSound(189, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-10-25 06:42:29 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, 189) && !S_CheckActorSoundPlaying(pact, 187))
|
|
|
|
S_PlayActorSound(187, 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->drink_amt > 88 && p->moto_drink == 0)
|
|
|
|
{
|
2020-11-04 21:22:01 +00:00
|
|
|
rng = krand() & 63;
|
|
|
|
if (rng == 1)
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_drink = -10;
|
2020-11-04 21:22:01 +00:00
|
|
|
else if (rng == 2)
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_drink = 10;
|
|
|
|
}
|
|
|
|
else if (p->drink_amt > 99 && p->moto_drink == 0)
|
|
|
|
{
|
2020-11-04 21:22:01 +00:00
|
|
|
rng = krand() & 31;
|
|
|
|
if (rng == 1)
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_drink = -20;
|
2020-11-04 21:22:01 +00:00
|
|
|
else if (rng == 2)
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_drink = 20;
|
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->on_ground == 1)
|
|
|
|
{
|
2021-01-03 08:25:49 +00:00
|
|
|
if (p->vehBraking && p->MotoSpeed > 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
p->MotoSpeed -= p->moto_on_oil ? 2 : 4;
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->MotoSpeed < 0)
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->VBumpTarget = -30;
|
|
|
|
p->moto_do_bump = 1;
|
|
|
|
}
|
2021-01-03 08:25:49 +00:00
|
|
|
else if (p->vehForwardScale != 0 && !p->vehBraking)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (p->MotoSpeed < 40)
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 70;
|
|
|
|
p->moto_bump_fast = 1;
|
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2020-11-04 23:07:39 +00:00
|
|
|
p->MotoSpeed += 2 * p->vehForwardScale;
|
|
|
|
p->vehForwardScale = 0;
|
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
|
|
|
|
|
|
|
if (!p->NotOnWater && p->MotoSpeed > 80)
|
|
|
|
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
|
|
|
|
2021-01-03 08:25:49 +00:00
|
|
|
if (p->moto_do_bump && (!p->vehBraking || 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
|
|
|
|
2021-01-03 08:25:49 +00:00
|
|
|
if (p->vehReverseScale != 0 && p->MotoSpeed <= 0 && !p->vehBraking)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
bool temp = p->vehTurnRight;
|
2020-11-04 23:19:15 +00:00
|
|
|
p->vehTurnRight = p->vehTurnLeft;
|
|
|
|
p->vehTurnLeft = temp;
|
2020-11-05 08:32:14 +00:00
|
|
|
p->MotoSpeed = -15 * p->vehReverseScale;
|
|
|
|
p->vehReverseScale = 0;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p->MotoSpeed != 0 && p->on_ground == 1)
|
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
if (!p->VBumpNow && (krand() & 3) == 2)
|
2021-05-12 15:33:33 +00:00
|
|
|
p->VBumpTarget = short((p->MotoSpeed / 16.) * ((krand() & 7) - 4));
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2020-11-04 23:19:15 +00:00
|
|
|
if (p->vehTurnLeft || p->moto_drink < 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (p->moto_drink < 0)
|
|
|
|
p->moto_drink++;
|
|
|
|
}
|
2020-11-04 23:19:15 +00:00
|
|
|
else if (p->vehTurnRight || p->moto_drink > 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (p->moto_drink > 0)
|
|
|
|
p->moto_drink--;
|
|
|
|
}
|
|
|
|
}
|
2020-09-22 12:50:27 +00:00
|
|
|
|
2020-10-15 09:33:28 +00:00
|
|
|
double horiz = FRACUNIT;
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->TurbCount)
|
|
|
|
{
|
|
|
|
if (p->TurbCount <= 1)
|
|
|
|
{
|
2020-10-14 23:20:52 +00:00
|
|
|
horiz = 0;
|
2020-05-17 21:44:53 +00:00
|
|
|
p->TurbCount = 0;
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->VBumpNow = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-14 23:20:52 +00:00
|
|
|
horiz = ((krand() & 15) - 7);
|
2020-05-17 21:44:53 +00:00
|
|
|
p->TurbCount--;
|
|
|
|
p->moto_drink = (krand() & 3) - 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->VBumpTarget > p->VBumpNow)
|
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
p->VBumpNow += p->moto_bump_fast ? 6 : 1;
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->VBumpTarget < p->VBumpNow)
|
|
|
|
p->VBumpNow = p->VBumpTarget;
|
2020-10-14 23:27:08 +00:00
|
|
|
horiz = p->VBumpNow / 3.;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else if (p->VBumpTarget < p->VBumpNow)
|
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
p->VBumpNow -= p->moto_bump_fast ? 6 : 1;
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->VBumpTarget > p->VBumpNow)
|
|
|
|
p->VBumpNow = p->VBumpTarget;
|
2020-10-14 23:27:08 +00:00
|
|
|
horiz = p->VBumpNow / 3.;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->moto_bump_fast = 0;
|
|
|
|
}
|
2020-10-15 09:33:28 +00:00
|
|
|
if (horiz != FRACUNIT)
|
2020-09-22 12:50:27 +00:00
|
|
|
{
|
2021-11-01 12:30:17 +00:00
|
|
|
p->horizon.addadjustment(horiz - p->horizon.horiz.asbuildf());
|
2020-09-22 12:50:27 +00:00
|
|
|
}
|
|
|
|
|
2021-05-12 15:33:33 +00:00
|
|
|
int currSpeed = int(p->MotoSpeed);
|
2021-11-07 13:36:39 +00:00
|
|
|
int velAdjustment;
|
2020-11-04 23:19:15 +00:00
|
|
|
if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->vehTurnLeft || p->vehTurnRight))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
velAdjustment = p->vehTurnLeft ? -10 : 10;
|
2021-04-11 08:34:07 +00:00
|
|
|
auto angAdjustment = (velAdjustment < 0 ? 350 : -350) << BAMBITS;
|
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
|
|
|
|
2020-11-22 09:50:03 +00:00
|
|
|
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
|
|
|
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
2021-04-11 08:34:07 +00:00
|
|
|
p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - bamang(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))
|
|
|
|
{
|
2020-11-04 21:22:01 +00:00
|
|
|
rng = krand() & 1;
|
2020-11-05 08:32:14 +00:00
|
|
|
velAdjustment = rng == 0 ? -10 : 10;
|
2021-01-04 11:36:54 +00:00
|
|
|
currSpeed = MulScale(currSpeed, p->moto_on_oil ? 10 : 5, 7);
|
2020-11-22 09:50:03 +00:00
|
|
|
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
|
|
|
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
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;
|
|
|
|
p->vehTurnLeft = p->vehTurnRight = p->vehBraking = false;
|
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
|
|
|
|
2021-01-03 08:25:49 +00:00
|
|
|
bool heeltoe;
|
2021-11-07 13:36:39 +00:00
|
|
|
int rng;
|
2020-11-05 08:32:14 +00:00
|
|
|
|
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
|
|
|
|
2021-01-03 08:25:49 +00:00
|
|
|
if (p->vehBraking && (p->vehForwardScale != 0))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-11-04 23:15:55 +00:00
|
|
|
heeltoe = true;
|
2021-01-03 08:25:49 +00:00
|
|
|
p->vehBraking = false;
|
2020-11-04 23:07:39 +00:00
|
|
|
p->vehForwardScale = 0;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
2020-11-04 23:15:55 +00:00
|
|
|
heeltoe = false;
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2020-11-04 23:07:39 +00:00
|
|
|
if (p->vehForwardScale != 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
if (p->MotoSpeed == 0 && !S_CheckActorSoundPlaying(pact, 89))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 87))
|
|
|
|
S_StopSound(87, pact);
|
|
|
|
S_PlayActorSound(89, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-10-25 06:42:29 +00:00
|
|
|
else if (p->MotoSpeed >= 50 && !S_CheckActorSoundPlaying(pact, 88))
|
|
|
|
S_PlayActorSound(88, pact);
|
|
|
|
else if (!S_CheckActorSoundPlaying(pact, 88) && !S_CheckActorSoundPlaying(pact, 89))
|
|
|
|
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, 89))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
S_StopSound(89, pact);
|
|
|
|
if (!S_CheckActorSoundPlaying(pact, 90))
|
|
|
|
S_PlayActorSound(90, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-10-25 06:42:29 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 88))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
S_StopSound(88, pact);
|
|
|
|
if (!S_CheckActorSoundPlaying(pact, 90))
|
|
|
|
S_PlayActorSound(90, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-10-25 06:42:29 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, 90) && !S_CheckActorSoundPlaying(pact, 87))
|
|
|
|
S_PlayActorSound(87, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
2020-11-05 08:32:14 +00:00
|
|
|
if (p->vehTurnLeft && !S_CheckActorSoundPlaying(pact, 91) && p->MotoSpeed > 30 && !p->NotOnWater)
|
|
|
|
S_PlayActorSound(91, pact);
|
|
|
|
|
|
|
|
if (p->vehTurnRight && !S_CheckActorSoundPlaying(pact, 91) && p->MotoSpeed > 30 && !p->NotOnWater)
|
|
|
|
S_PlayActorSound(91, pact);
|
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
if (!p->NotOnWater)
|
|
|
|
{
|
|
|
|
if (p->drink_amt > 88 && p->moto_drink == 0)
|
|
|
|
{
|
2020-11-04 21:22:01 +00:00
|
|
|
rng = krand() & 63;
|
|
|
|
if (rng == 1)
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_drink = -10;
|
2020-11-04 21:22:01 +00:00
|
|
|
else if (rng == 2)
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_drink = 10;
|
|
|
|
}
|
|
|
|
else if (p->drink_amt > 99 && p->moto_drink == 0)
|
|
|
|
{
|
2020-11-04 21:22:01 +00:00
|
|
|
rng = krand() & 31;
|
|
|
|
if (rng == 1)
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_drink = -20;
|
2020-11-04 21:22:01 +00:00
|
|
|
else if (rng == 2)
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_drink = 20;
|
|
|
|
}
|
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->on_ground == 1)
|
|
|
|
{
|
2020-11-04 21:22:01 +00:00
|
|
|
if (heeltoe)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (p->MotoSpeed <= 25)
|
|
|
|
{
|
|
|
|
p->MotoSpeed++;
|
2020-10-25 06:42:29 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, 182))
|
|
|
|
S_PlayActorSound(182, pact);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->MotoSpeed -= 2;
|
|
|
|
if (p->MotoSpeed < 0)
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->VBumpTarget = 30;
|
|
|
|
p->moto_do_bump = 1;
|
|
|
|
}
|
|
|
|
}
|
2021-01-03 08:25:49 +00:00
|
|
|
else if (p->vehBraking && p->MotoSpeed > 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
p->MotoSpeed -= 2;
|
|
|
|
if (p->MotoSpeed < 0)
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->VBumpTarget = 30;
|
|
|
|
p->moto_do_bump = 1;
|
|
|
|
}
|
2020-11-04 23:07:39 +00:00
|
|
|
else if (p->vehForwardScale != 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
if (p->MotoSpeed < 40 && !p->NotOnWater)
|
|
|
|
{
|
|
|
|
p->VBumpTarget = -30;
|
|
|
|
p->moto_bump_fast = 1;
|
|
|
|
}
|
2020-11-04 23:07:39 +00:00
|
|
|
p->MotoSpeed += 1 * p->vehForwardScale;
|
|
|
|
p->vehForwardScale = 0;
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->MotoSpeed > 120)
|
|
|
|
p->MotoSpeed = 120;
|
|
|
|
}
|
|
|
|
else if (p->MotoSpeed > 0)
|
|
|
|
p->MotoSpeed--;
|
2020-11-05 08:32:14 +00:00
|
|
|
|
2021-01-03 08:25:49 +00:00
|
|
|
if (p->moto_do_bump && (!p->vehBraking || 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
|
|
|
|
2021-01-03 08:25:49 +00:00
|
|
|
if (p->vehReverseScale != 0 && p->MotoSpeed == 0 && !p->vehBraking)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
bool temp = p->vehTurnRight;
|
2020-11-04 23:19:15 +00:00
|
|
|
p->vehTurnRight = p->vehTurnLeft;
|
|
|
|
p->vehTurnLeft = temp;
|
2020-11-05 08:32:14 +00:00
|
|
|
p->MotoSpeed = -(!p->NotOnWater ? 25 : 20) * p->vehReverseScale;
|
|
|
|
p->vehReverseScale = 0;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p->MotoSpeed != 0 && p->on_ground == 1)
|
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
if (!p->VBumpNow && (krand() & 15) == 14)
|
2021-05-12 15:33:33 +00:00
|
|
|
p->VBumpTarget = short((p->MotoSpeed / 16.) * ((krand() & 3) - 2));
|
2020-11-05 08:32:14 +00:00
|
|
|
|
|
|
|
if (p->vehTurnLeft && p->moto_drink < 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
p->moto_drink++;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
else if (p->vehTurnRight && p->moto_drink > 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
p->moto_drink--;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-22 12:50:27 +00:00
|
|
|
|
2020-10-15 09:33:28 +00:00
|
|
|
double horiz = FRACUNIT;
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->TurbCount)
|
|
|
|
{
|
|
|
|
if (p->TurbCount <= 1)
|
|
|
|
{
|
2020-10-14 23:20:52 +00:00
|
|
|
horiz = 0;
|
2020-05-17 21:44:53 +00:00
|
|
|
p->TurbCount = 0;
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->VBumpNow = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-14 23:20:52 +00:00
|
|
|
horiz = ((krand() & 15) - 7);
|
2020-05-17 21:44:53 +00:00
|
|
|
p->TurbCount--;
|
|
|
|
p->moto_drink = (krand() & 3) - 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->VBumpTarget > p->VBumpNow)
|
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
p->VBumpNow += p->moto_bump_fast ? 6 : 1;
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->VBumpTarget < p->VBumpNow)
|
|
|
|
p->VBumpNow = p->VBumpTarget;
|
2020-10-14 23:27:08 +00:00
|
|
|
horiz = p->VBumpNow / 3.;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else if (p->VBumpTarget < p->VBumpNow)
|
|
|
|
{
|
2020-11-05 08:32:14 +00:00
|
|
|
p->VBumpNow -= p->moto_bump_fast ? 6 : 1;
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->VBumpTarget > p->VBumpNow)
|
|
|
|
p->VBumpNow = p->VBumpTarget;
|
2020-10-14 23:27:08 +00:00
|
|
|
horiz = p->VBumpNow / 3.;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->moto_bump_fast = 0;
|
|
|
|
}
|
2020-10-15 09:33:28 +00:00
|
|
|
if (horiz != FRACUNIT)
|
2020-09-22 12:50:27 +00:00
|
|
|
{
|
2021-11-01 12:30:17 +00:00
|
|
|
p->horizon.addadjustment(horiz - p->horizon.horiz.asbuildf());
|
2020-09-22 12:50:27 +00:00
|
|
|
}
|
|
|
|
|
2020-11-04 23:19:15 +00:00
|
|
|
if (p->MotoSpeed > 0 && p->on_ground == 1 && (p->vehTurnLeft || p->vehTurnRight))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2021-05-12 15:33:33 +00:00
|
|
|
int currSpeed = int(p->MotoSpeed * 4.);
|
2021-11-07 13:36:39 +00:00
|
|
|
int velAdjustment = p->vehTurnLeft ? -10 : 10;
|
2021-04-11 08:34:07 +00:00
|
|
|
auto angAdjustment = (velAdjustment < 0 ? 350 : -350) << BAMBITS;
|
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
|
|
|
|
2020-11-22 09:50:03 +00:00
|
|
|
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
|
|
|
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
2021-04-11 08:34:07 +00:00
|
|
|
p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - bamang(angAdjustment)));
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-11-05 08:32:14 +00:00
|
|
|
if (p->NotOnWater && p->MotoSpeed > 50)
|
|
|
|
p->MotoSpeed -= (p->MotoSpeed / 2.);
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2021-01-03 08:25:49 +00:00
|
|
|
p->vehTurnLeft = p->vehTurnRight = p->vehBraking = false;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int shrunk, int 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();
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = pact->s;
|
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;
|
|
|
|
|
|
|
|
int i = 40;
|
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;
|
2020-11-15 11:07:30 +00:00
|
|
|
p->pyoff = bsin(p->pycount, -6);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else i = 12;
|
|
|
|
|
2020-11-29 12:54:58 +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)
|
|
|
|
p->dummyplayersprite = spawn(pact, PLAYERONWATER);
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
p->footprintcount = 6;
|
2021-11-06 20:59:42 +00:00
|
|
|
if (p->cursector()->floorpicnum == FLOORSLIME)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
p->footprintpal = 8;
|
|
|
|
p->footprintshade = 0;
|
|
|
|
}
|
2021-11-06 20:59:42 +00:00
|
|
|
else if (isRRRA() && (p->cursector()->floorpicnum == RRTILE7756 || p->cursector()->floorpicnum == RRTILE7888))
|
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);
|
|
|
|
}
|
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
if (p->pos.z < (fz - (i << 8))) //falling
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (sector[psect].floorstat & 2) && p->pos.z >= (fz - (i << 8) - (16 << 8)))
|
|
|
|
p->pos.z = fz - (i << 8);
|
2020-05-17 21:44:53 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
p->on_ground = 0;
|
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
if ((p->OnMotorcycle || p->OnBoat) && fz - (i << 8) * 2 > p->pos.z)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (p->MotoOnGround)
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 80;
|
|
|
|
p->moto_bump_fast = 1;
|
2020-11-29 12:54:58 +00:00
|
|
|
p->poszv -= xs_CRoundToInt(gs.gravity * (p->MotoSpeed / 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
|
|
|
|
{
|
2021-05-12 15:33:33 +00:00
|
|
|
p->poszv += gs.gravity - 80 + int(120 - p->MotoSpeed);
|
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
|
2020-11-29 12:54:58 +00:00
|
|
|
p->poszv += (gs.gravity + 80); // (TICSPERFRAME<<6);
|
2020-05-17 16:04:45 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->poszv >= (4096 + 2048)) p->poszv = (4096 + 2048);
|
|
|
|
if (p->poszv > 2400 && p->falling_counter < 255)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
if ((p->pos.z + p->poszv) >= (fz - (i << 8))) // 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-06 20:59:42 +00:00
|
|
|
if (p->cursector()->lotag != 1)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (isRRRA()) p->MotoOnGround = 1;
|
2021-11-06 20:59:42 +00:00
|
|
|
if (p->falling_counter > 62 || (isRRRA() && p->falling_counter > 2 && 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;
|
|
|
|
s->extra -= j - (krand() & 3);
|
|
|
|
if (s->extra <= 0)
|
|
|
|
{
|
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));
|
|
|
|
}
|
|
|
|
else if (p->poszv > 2048)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
else if (p->poszv > 1024 && p->OnMotorcycle)
|
|
|
|
{
|
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
|
|
|
|
|
|
|
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->poszv > (6144 >> 1))
|
|
|
|
p->hard_landing = p->poszv >> 10;
|
|
|
|
|
|
|
|
p->on_ground = 1;
|
|
|
|
|
|
|
|
if (i == 40)
|
|
|
|
{
|
|
|
|
//Smooth on the ground
|
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
int k = ((fz - (i << 8)) - p->pos.z) >> 1;
|
2020-05-17 21:44:53 +00:00
|
|
|
if (abs(k) < 256) k = 0;
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.z += k;
|
2020-05-17 21:44:53 +00:00
|
|
|
p->poszv -= 768;
|
|
|
|
if (p->poszv < 0) p->poszv = 0;
|
|
|
|
}
|
|
|
|
else if (p->jumping_counter == 0)
|
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.z += ((fz - (i << 7)) - p->pos.z) >> 1; //Smooth on the water
|
|
|
|
if (p->on_warping_sector == 0 && p->pos.z > fz - (16 << 8))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.z = fz - (16 << 8);
|
2020-05-17 21:44:53 +00:00
|
|
|
p->poszv >>= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
p->on_warping_sector = 0;
|
|
|
|
|
2020-08-28 20:51:05 +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
|
|
|
{
|
|
|
|
playerJump(snum, fz, cz);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
p->poszv = -512;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-29 09:00:15 +00:00
|
|
|
p->poszv -= bsin(2048 - 128 + p->jumping_counter) / 12;
|
2020-05-17 21:44:53 +00:00
|
|
|
p->jumping_counter += 180;
|
|
|
|
p->on_ground = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->jumping_counter = 0;
|
|
|
|
p->poszv = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.z += p->poszv;
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
if (p->pos.z < (cz + (4 << 8)))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
p->jumping_counter = 0;
|
|
|
|
if (p->poszv < 0)
|
|
|
|
p->posxv = p->posyv = 0;
|
|
|
|
p->poszv = 128;
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.z = cz + (4 << 8);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
static void underwater(int snum, ESyncBits actions, int psect, int fz, int cz)
|
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
|
|
|
int psectlotag = sector[psect].lotag;
|
|
|
|
|
|
|
|
p->jumping_counter = 0;
|
|
|
|
|
|
|
|
p->pycount += 32;
|
|
|
|
p->pycount &= 2047;
|
2020-11-15 11:07:30 +00:00
|
|
|
p->pyoff = bsin(p->pycount, -7);
|
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
|
|
|
{
|
|
|
|
if (p->poszv > 0) p->poszv = 0;
|
|
|
|
p->poszv -= 348;
|
|
|
|
if (p->poszv < -(256 * 6)) p->poszv = -(256 * 6);
|
|
|
|
}
|
2021-01-24 07:59:08 +00:00
|
|
|
else if ((actions & SB_CROUCH) || p->OnMotorcycle)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
if (p->poszv < 0) p->poszv = 0;
|
|
|
|
p->poszv += 348;
|
|
|
|
if (p->poszv > (256 * 6)) p->poszv = (256 * 6);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p->poszv < 0)
|
|
|
|
{
|
|
|
|
p->poszv += 256;
|
|
|
|
if (p->poszv > 0)
|
|
|
|
p->poszv = 0;
|
|
|
|
}
|
|
|
|
if (p->poszv > 0)
|
|
|
|
{
|
|
|
|
p->poszv -= 256;
|
|
|
|
if (p->poszv < 0)
|
|
|
|
p->poszv = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->poszv > 2048)
|
|
|
|
p->poszv >>= 1;
|
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.z += p->poszv;
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
if (p->pos.z > (fz - (15 << 8)))
|
|
|
|
p->pos.z += ((fz - (15 << 8)) - p->pos.z) >> 1;
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
if (p->pos.z < (cz + (4 << 8)))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.z = cz + (4 << 8);
|
2020-05-17 21:44:53 +00:00
|
|
|
p->poszv = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->scuba_on && (krand() & 255) < 8)
|
|
|
|
{
|
2020-10-25 06:42:29 +00:00
|
|
|
auto j = spawn(pact, WATERBUBBLE);
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->x += bcos(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6);
|
|
|
|
j->s->y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6);
|
|
|
|
j->s->xrepeat = 3;
|
|
|
|
j->s->yrepeat = 2;
|
2021-10-31 06:52:52 +00:00
|
|
|
j->s->z = p->pos.z + (8 << 8);
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->cstat = 514;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void onMotorcycleMove(int snum, int psect, int j)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-25 06:42:29 +00:00
|
|
|
auto pact = p->GetActor();
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = pact->s;
|
2020-05-17 22:10:42 +00:00
|
|
|
int psectlotag = sector[psect].lotag;
|
2021-11-07 13:36:39 +00:00
|
|
|
int angleDelta = abs(p->angle.ang.asbuild() - getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y));
|
|
|
|
int damageAmount;
|
2020-11-05 08:32:14 +00:00
|
|
|
|
|
|
|
p->angle.addadjustment(p->MotoSpeed / (krand() & 1 ? -2 : 2));
|
2020-05-17 22:10:42 +00:00
|
|
|
|
2020-11-04 21:22:01 +00:00
|
|
|
if (angleDelta >= 441 && angleDelta <= 581)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-11-04 22:17:18 +00:00
|
|
|
damageAmount = xs_CRoundToInt((p->MotoSpeed * p->MotoSpeed) / 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
|
|
|
}
|
2020-11-04 21:22:01 +00:00
|
|
|
else if (angleDelta >= 311 && angleDelta <= 711)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-11-04 22:17:18 +00:00
|
|
|
damageAmount = xs_CRoundToInt((p->MotoSpeed * p->MotoSpeed) / 2048.);
|
|
|
|
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
|
|
|
}
|
2020-11-04 21:22:01 +00:00
|
|
|
else if (angleDelta >= 111 && angleDelta <= 911)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-11-04 22:17:18 +00:00
|
|
|
damageAmount = xs_CRoundToInt((p->MotoSpeed * p->MotoSpeed) / 16384.);
|
|
|
|
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
|
|
|
|
{
|
2020-11-04 22:17:18 +00:00
|
|
|
damageAmount = xs_CRoundToInt((p->MotoSpeed * p->MotoSpeed) / 32768.);
|
|
|
|
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
|
|
|
}
|
2020-11-04 21:22:01 +00:00
|
|
|
s->extra -= damageAmount;
|
2020-05-17 22:10:42 +00:00
|
|
|
if (s->extra <= 0)
|
|
|
|
{
|
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
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void onBoatMove(int snum, int psect, int j)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-25 06:42:29 +00:00
|
|
|
auto pact = p->GetActor();
|
2020-05-17 22:10:42 +00:00
|
|
|
int psectlotag = sector[psect].lotag;
|
2021-11-07 13:36:39 +00:00
|
|
|
int angleDelta = abs(p->angle.ang.asbuild() - getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y));
|
2020-11-05 08:32:14 +00:00
|
|
|
|
|
|
|
p->angle.addadjustment(p->MotoSpeed / (krand() & 1 ? -4 : 4));
|
2020-05-17 22:10:42 +00:00
|
|
|
|
2020-11-04 21:22:01 +00:00
|
|
|
if (angleDelta >= 441 && angleDelta <= 581)
|
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
|
|
|
}
|
2020-11-04 21:22:01 +00:00
|
|
|
else if (angleDelta >= 311 && angleDelta <= 711)
|
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
|
|
|
}
|
2020-11-04 21:22:01 +00:00
|
|
|
else if (angleDelta >= 111 && angleDelta <= 911)
|
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];
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = victim->s;
|
2020-10-12 21:06:08 +00:00
|
|
|
if (badguy(s) || s->picnum == APLAYER)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-10-12 21:06:08 +00:00
|
|
|
if (s->picnum != APLAYER)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
|
|
|
if (numplayers == 1)
|
|
|
|
{
|
2020-10-25 07:09:24 +00:00
|
|
|
Collision coll;
|
2021-05-12 15:33:33 +00:00
|
|
|
int ang = int(p->TiltStatus * 20 + p->angle.ang.asbuild());
|
|
|
|
movesprite_ex(victim, bcos(ang, -8), bsin(ang, -8), s->zvel, CLIPMASK0, coll);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2020-10-25 07:09:24 +00:00
|
|
|
victim->SetHitOwner(p->GetActor());
|
|
|
|
victim->picnum = MOTOHIT;
|
2020-11-04 22:17:18 +00:00
|
|
|
victim->extra = xs_CRoundToInt(p->MotoSpeed / 2.);
|
|
|
|
p->MotoSpeed -= p->MotoSpeed / 4.;
|
2020-05-17 22:10:42 +00:00
|
|
|
p->TurbCount = 6;
|
|
|
|
}
|
2020-10-12 21:06:08 +00:00
|
|
|
else if ((s->picnum == RRTILE2431 || s->picnum == RRTILE2443 || s->picnum == RRTILE2451 || s->picnum == RRTILE2455)
|
|
|
|
&& s->picnum != ACTIVATORLOCKED && p->MotoSpeed > 45)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-10-25 07:09:24 +00:00
|
|
|
S_PlayActorSound(SQUISHED, victim);
|
2020-10-12 21:06:08 +00:00
|
|
|
if (s->picnum == RRTILE2431 || s->picnum == RRTILE2451)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-10-12 21:06:08 +00:00
|
|
|
if (s->lotag != 0)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-10-25 07:12:25 +00:00
|
|
|
DukeSpriteIterator it;
|
|
|
|
while (auto act2 = it.Next())
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto sprj = act2->s;
|
2020-10-12 21:06:08 +00:00
|
|
|
if ((sprj->picnum == RRTILE2431 || sprj->picnum == RRTILE2451) && sprj->pal == 4)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-10-12 21:06:08 +00:00
|
|
|
if (s->lotag == sprj->lotag)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-10-12 21:06:08 +00:00
|
|
|
sprj->xrepeat = 0;
|
|
|
|
sprj->yrepeat = 0;
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-25 07:09:24 +00:00
|
|
|
fi.guts(victim, RRTILE2460, 12, myconnectindex);
|
|
|
|
fi.guts(victim, RRTILE2465, 3, myconnectindex);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
else
|
2020-10-25 07:09:24 +00:00
|
|
|
fi.guts(victim, RRTILE2465, 3, myconnectindex);
|
|
|
|
fi.guts(victim, RRTILE2465, 3, myconnectindex);
|
2020-10-12 21:06:08 +00:00
|
|
|
s->xrepeat = 0;
|
|
|
|
s->yrepeat = 0;
|
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];
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = victim->s;
|
2020-10-12 21:06:08 +00:00
|
|
|
|
|
|
|
if (badguy(s) || s->picnum == APLAYER)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
2020-10-12 21:06:08 +00:00
|
|
|
if (s->picnum != APLAYER)
|
2020-05-17 22:10:42 +00:00
|
|
|
{
|
|
|
|
if (numplayers == 1)
|
|
|
|
{
|
2020-10-25 07:09:24 +00:00
|
|
|
Collision coll;
|
2021-05-12 15:33:33 +00:00
|
|
|
int ang = int(p->TiltStatus * 20 + p->angle.ang.asbuild());
|
|
|
|
movesprite_ex(victim, bcos(ang, -9), bsin(ang, -9), s->zvel, CLIPMASK0, coll);
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2020-10-25 07:09:24 +00:00
|
|
|
victim->SetHitOwner(p->GetActor());
|
|
|
|
victim->picnum = MOTOHIT;
|
2020-11-04 22:17:18 +00:00
|
|
|
victim->extra = xs_CRoundToInt(p->MotoSpeed / 4.);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-30 22:33:41 +00:00
|
|
|
static void operateweapon(int snum, ESyncBits actions, int psect)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-24 05:34:39 +00:00
|
|
|
auto pact = p->GetActor();
|
|
|
|
int i, k;
|
2020-05-18 20:28:12 +00:00
|
|
|
int psectlotag = sector[psect].lotag;
|
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;
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 8192;
|
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
|
|
|
{
|
2020-05-18 20:28:12 +00:00
|
|
|
p->ammo_amount[DYNAMITE_WEAPON]--;
|
|
|
|
if (p->ammo_amount[CROSSBOW_WEAPON])
|
|
|
|
p->ammo_amount[CROSSBOW_WEAPON]--;
|
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
|
|
|
{
|
|
|
|
k = 15;
|
2021-01-04 11:36:54 +00:00
|
|
|
i = -MulScale(p->horizon.sum().asq16(), 20, 16);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
k = 140;
|
2021-05-20 17:06:11 +00:00
|
|
|
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 05:34:39 +00:00
|
|
|
auto spawned = EGS(p->cursectnum,
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.x + p->angle.ang.bcos(-6),
|
|
|
|
p->pos.y + p->angle.ang.bsin(-6),
|
|
|
|
p->pos.z, HEAVYHBOMB, -16, 9, 9,
|
2020-10-24 05:34:39 +00:00
|
|
|
p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)) * 2, i, pact, 1);
|
2020-05-18 06:26:09 +00:00
|
|
|
|
|
|
|
if (k == 15)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->yvel = 3;
|
|
|
|
spawned->s->z += (8 << 8);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
|
2020-10-23 17:33:54 +00:00
|
|
|
k = hits(p->GetActor());
|
2020-05-18 06:26:09 +00:00
|
|
|
if (k < 512)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->ang += 1024;
|
|
|
|
spawned->s->zvel /= 3;
|
|
|
|
spawned->s->xvel /= 3;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
p->hbomb_on = 1;
|
|
|
|
}
|
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
|
|
|
{
|
2020-05-18 20:28:12 +00:00
|
|
|
fi.addweapon(p, DYNAMITE_WEAPON);
|
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
|
|
|
{
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(pact, SHOTSPARK1);
|
|
|
|
S_PlayActorSound(PISTOL_FIRE, pact);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 8192;
|
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)
|
|
|
|
{
|
2020-11-15 11:07:30 +00:00
|
|
|
p->posxv -= p->angle.ang.bcos(4);
|
|
|
|
p->posyv -= p->angle.ang.bsin(4);
|
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
|
|
|
{
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
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
|
|
|
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 8192;
|
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
|
|
|
{
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
|
|
|
fi.shoot(pact, SHOTGUN);
|
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)
|
|
|
|
{
|
2020-11-15 11:07:30 +00:00
|
|
|
p->posxv -= p->angle.ang.bcos(5);
|
|
|
|
p->posyv -= p->angle.ang.bsin(5);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (psectlotag != 857)
|
|
|
|
{
|
2020-11-15 11:07:30 +00:00
|
|
|
p->posxv -= p->angle.ang.bcos(4);
|
|
|
|
p->posyv -= p->angle.ang.bsin(4);
|
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++;
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.addadjustment(1);
|
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
|
|
|
{
|
2020-10-24 05:34:39 +00:00
|
|
|
auto j = spawn(pact, SHELL);
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->ang += 1024;
|
|
|
|
j->s->ang &= 2047;
|
|
|
|
j->s->xvel += 32;
|
|
|
|
j->s->z += (3 << 8);
|
2020-05-18 06:26:09 +00:00
|
|
|
ssp(j, CLIPMASK0);
|
|
|
|
}
|
|
|
|
|
2020-10-24 05:34:39 +00:00
|
|
|
S_PlayActorSound(CHAINGUN_FIRE, pact);
|
|
|
|
fi.shoot(pact, CHAINGUN);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 8192;
|
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)
|
|
|
|
{
|
2020-11-15 11:07:30 +00:00
|
|
|
p->posxv -= p->angle.ang.bcos(4);
|
|
|
|
p->posyv -= p->angle.ang.bsin(4);
|
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;
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(pact, GROWSPARK);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 1024;
|
|
|
|
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]--;
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(pact, SHRINKSPARK);
|
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);
|
|
|
|
fi.shoot(pact, SHOTSPARK1);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 16384;
|
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
|
|
|
{
|
2020-10-07 12:13:21 +00:00
|
|
|
p->angle.addadjustment(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
|
|
|
{
|
2020-10-07 12:13:21 +00:00
|
|
|
p->angle.addadjustment(-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);
|
|
|
|
fi.shoot(pact, CHAINGUN);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 16384;
|
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
|
|
|
{
|
2020-10-07 12:13:21 +00:00
|
|
|
p->angle.addadjustment(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
|
|
|
{
|
2020-10-07 12:13:21 +00:00
|
|
|
p->angle.addadjustment(-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]--;
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(pact, RRTILE1790);
|
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)
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(pact, FIRELASER);
|
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);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 2048;
|
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
|
|
|
{
|
2020-11-15 11:07:30 +00:00
|
|
|
p->posxv -= p->angle.ang.bcos(4);
|
|
|
|
p->posyv -= p->angle.ang.bsin(4);
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.addadjustment(20);
|
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
|
|
|
{
|
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
|
|
|
{
|
2020-05-18 20:28:12 +00:00
|
|
|
k = 15;
|
2021-01-04 11:36:54 +00:00
|
|
|
i = MulScale(p->horizon.sum().asq16(), 20, 16);
|
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
|
|
|
{
|
2020-05-18 20:28:12 +00:00
|
|
|
k = 32;
|
2021-01-04 11:36:54 +00:00
|
|
|
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
2020-05-18 20:28:12 +00:00
|
|
|
|
2020-10-24 05:34:39 +00:00
|
|
|
EGS(p->cursectnum,
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.x + p->angle.ang.bcos(-6),
|
|
|
|
p->pos.y + p->angle.ang.bsin(-6),
|
|
|
|
p->pos.z, TRIPBOMBSPRITE, -16, 9, 9,
|
2020-10-24 05:34:39 +00:00
|
|
|
p->angle.ang.asbuild(), k * 2, i, 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);
|
|
|
|
fi.shoot(pact, BOWLINGBALL);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 1024;
|
|
|
|
madenoise(snum);
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->kickback_pic < 30)
|
2020-05-18 20:28:12 +00:00
|
|
|
{
|
2020-11-15 11:07:30 +00:00
|
|
|
p->posxv += p->angle.ang.bcos(4);
|
|
|
|
p->posyv += p->angle.ang.bsin(4);
|
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
|
|
|
{
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(pact, KNEE);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 1024;
|
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
|
|
|
{
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(pact, SLINGBLADE);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 1024;
|
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;
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(pact, RPG);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 32768;
|
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;
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(pact, RPG2);
|
2020-05-18 20:28:12 +00:00
|
|
|
p->noise_radius = 32768;
|
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
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
static void processweapon(int snum, ESyncBits actions, int psect)
|
2020-05-19 07:54:52 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-25 07:12:25 +00:00
|
|
|
auto pact = p->GetActor();
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = pact->s;
|
2020-05-19 07:54:52 +00:00
|
|
|
int shrunk = (s->yrepeat < 8);
|
|
|
|
|
2020-08-28 20:51:05 +00:00
|
|
|
if (actions & SB_FIRE)
|
2020-05-19 07:54:52 +00:00
|
|
|
{
|
|
|
|
int a = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2020-08-30 22:33:41 +00:00
|
|
|
operateweapon(snum, actions, psect);
|
2020-05-19 07:54:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void processinput_r(int snum)
|
|
|
|
{
|
2020-10-25 07:25:45 +00:00
|
|
|
int i, k, doubvel, fz, cz, truefdist;
|
|
|
|
Collision chz, clz;
|
2021-11-07 15:46:23 +00:00
|
|
|
bool shrunk;
|
|
|
|
int psect, psectlotag;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-10-25 07:12:25 +00:00
|
|
|
auto p = &ps[snum];
|
|
|
|
auto pact = p->GetActor();
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = pact->s;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-10-12 03:42:43 +00:00
|
|
|
p->horizon.resetadjustment();
|
|
|
|
p->angle.resetadjustment();
|
2020-05-19 17:50:31 +00:00
|
|
|
|
2021-04-21 10:41:04 +00:00
|
|
|
ESyncBits& actions = p->sync.actions;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-07-14 22:26:58 +00:00
|
|
|
auto sb_fvel = PlayerInputForwardVel(snum);
|
|
|
|
auto sb_svel = PlayerInputSideVel(snum);
|
|
|
|
auto sb_avel = PlayerInputAngVel(snum);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
psect = p->cursectnum;
|
|
|
|
if (p->OnMotorcycle && s->extra > 0)
|
|
|
|
{
|
2020-08-29 11:32:14 +00:00
|
|
|
onMotorcycle(snum, actions);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else if (p->OnBoat && s->extra > 0)
|
|
|
|
{
|
2020-08-29 11:32:14 +00:00
|
|
|
onBoat(snum, actions);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
if (psect == -1)
|
|
|
|
{
|
|
|
|
if (s->extra > 0 && ud.clipping == 0)
|
|
|
|
{
|
|
|
|
quickkill(p);
|
2020-10-25 07:12:25 +00:00
|
|
|
S_PlayActorSound(SQUISHED, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
psect = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
psectlotag = sector[psect].lotag;
|
|
|
|
|
|
|
|
if (psectlotag == 867)
|
|
|
|
{
|
2020-10-25 07:25:45 +00:00
|
|
|
DukeSectIterator it(psect);
|
|
|
|
while (auto act2 = it.Next())
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (act2->s->picnum == RRTILE380)
|
2021-10-31 06:52:52 +00:00
|
|
|
if (act2->s->z - (8 << 8) < p->pos.z)
|
2020-05-19 07:03:07 +00:00
|
|
|
psectlotag = 2;
|
|
|
|
}
|
|
|
|
}
|
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;
|
|
|
|
|
|
|
|
if (psectlotag == 848 && sector[psect].floorpicnum == WATERTILE2)
|
|
|
|
psectlotag = 1;
|
|
|
|
|
|
|
|
if (psectlotag == 857)
|
|
|
|
s->clipdist = 1;
|
|
|
|
else
|
|
|
|
s->clipdist = 64;
|
|
|
|
|
|
|
|
p->spritebridge = 0;
|
|
|
|
|
|
|
|
shrunk = (s->yrepeat < 8);
|
2020-10-25 07:25:45 +00:00
|
|
|
int tempfz;
|
2020-05-19 07:03:07 +00:00
|
|
|
if (s->clipdist == 64)
|
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
getzrange_ex(p->pos.x, p->pos.y, p->pos.z, psect, &cz, chz, &fz, clz, 163L, CLIPMASK0);
|
|
|
|
tempfz = getflorzofslope(psect, p->pos.x, p->pos.y);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
getzrange_ex(p->pos.x, p->pos.y, p->pos.z, psect, &cz, chz, &fz, clz, 4L, CLIPMASK0);
|
|
|
|
tempfz = getflorzofslope(psect, p->pos.x, p->pos.y);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
2020-10-25 07:25:45 +00:00
|
|
|
p->truefz = tempfz;
|
2021-10-31 06:52:52 +00:00
|
|
|
p->truecz = getceilzofslope(psect, p->pos.x, p->pos.y);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
truefdist = abs(p->pos.z - tempfz);
|
2020-11-29 12:54:58 +00:00
|
|
|
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + (16 << 8))
|
2020-05-19 07:03:07 +00:00
|
|
|
psectlotag = 0;
|
|
|
|
|
2020-10-25 07:12:25 +00:00
|
|
|
pact->floorz = fz;
|
|
|
|
pact->ceilingz = cz;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-11-30 22:40:16 +00:00
|
|
|
if (SyncInput())
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.backup();
|
2021-01-01 22:32:19 +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-04-15 17:21:43 +00:00
|
|
|
if (chz.actor->s->statnum == 1 && chz.actor->s->extra >= 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-10-25 07:25:45 +00:00
|
|
|
chz.type = kHitNone;
|
|
|
|
chz.actor = nullptr;
|
2020-05-19 07:03:07 +00:00
|
|
|
cz = p->truecz;
|
|
|
|
}
|
2021-06-08 22:31:18 +00:00
|
|
|
else if (chz.actor->s->picnum == 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
|
|
|
{
|
2020-10-25 07:25:45 +00:00
|
|
|
chz.type = kHitNone;
|
|
|
|
chz.actor = nullptr;
|
2020-05-19 07:03:07 +00:00
|
|
|
cz = p->truecz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p->stairs--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-25 07:25:45 +00:00
|
|
|
if (clz.type == kHitSprite)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if ((clz.actor->s->cstat & 33) == 33)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
psectlotag = 0;
|
|
|
|
p->footprintcount = 0;
|
|
|
|
p->spritebridge = 1;
|
|
|
|
}
|
|
|
|
if (p->OnMotorcycle)
|
2020-10-25 07:25:45 +00:00
|
|
|
if (badguy(clz.actor))
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-10-25 07:25:45 +00:00
|
|
|
clz.actor->picnum = MOTOHIT;
|
2020-11-04 22:17:18 +00:00
|
|
|
clz.actor->extra = xs_CRoundToInt(2 + (p->MotoSpeed / 2.));
|
|
|
|
p->MotoSpeed -= p->MotoSpeed / 16.;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
if (p->OnBoat)
|
|
|
|
{
|
2020-10-25 07:25:45 +00:00
|
|
|
if (badguy(clz.actor))
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-10-25 07:25:45 +00:00
|
|
|
clz.actor->picnum = MOTOHIT;
|
2020-11-04 22:17:18 +00:00
|
|
|
clz.actor->extra = xs_CRoundToInt(2 + (p->MotoSpeed / 2.));
|
|
|
|
p->MotoSpeed -= p->MotoSpeed / 16.;
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
else if (badguy(clz.actor) && clz.actor->s->xrepeat > 24 && abs(s->z - clz.actor->s->z) < (84 << 8))
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
int j = getangle(clz.actor->s->x - p->pos.x, clz.actor->s->y - p->pos.y);
|
2020-11-15 11:07:30 +00:00
|
|
|
p->posxv -= bcos(j, 4);
|
|
|
|
p->posyv -= bsin(j, 4);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2021-06-08 22:31:18 +00:00
|
|
|
if (clz.actor->s->picnum == 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
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
cz = clz.actor->s->z;
|
2020-10-25 07:25:45 +00:00
|
|
|
chz.type = kHitNone;
|
|
|
|
chz.actor = nullptr;
|
2021-04-15 17:21:43 +00:00
|
|
|
fz = clz.actor->s->z + (4 << 8);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p->stairs--;
|
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
else if (clz.actor->s->picnum == TOILET || clz.actor->s->picnum == RRTILE2121)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-08-28 20:51:05 +00:00
|
|
|
if ((actions & SB_CROUCH) && !p->OnMotorcycle)
|
2020-05-19 07:03:07 +00:00
|
|
|
//if (Sound[436].num == 0)
|
|
|
|
{
|
2020-10-25 07:25:45 +00:00
|
|
|
S_PlayActorSound(436, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
p->last_pissed_time = 4000;
|
|
|
|
p->eat = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (s->extra > 0) fi.incur_damage(p);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->extra = 0;
|
|
|
|
p->shield_amount = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->last_extra = s->extra;
|
|
|
|
|
|
|
|
if (p->loogcnt > 0) p->loogcnt--;
|
|
|
|
else p->loogcnt = 0;
|
|
|
|
|
|
|
|
if (p->fist_incs)
|
|
|
|
{
|
|
|
|
if (endoflevel(snum)) return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->timebeforeexit > 1 && p->last_extra > 0)
|
|
|
|
{
|
|
|
|
if (timedexit(snum))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-07-16 13:03:09 +00:00
|
|
|
if (s->extra <= 0 && !ud.god)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
playerisdead(snum, psectlotag, fz, cz);
|
2020-07-16 13:03:09 +00:00
|
|
|
return;
|
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
|
|
|
{
|
|
|
|
p->posxv = p->posyv = s->xvel = 0;
|
|
|
|
|
|
|
|
fi.doincrements(p);
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
if (p->curr_weapon == THROWINGDYNAMITE_WEAPON) processweapon(snum, actions, psect);
|
2020-05-19 07:03:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
doubvel = TICSPERFRAME;
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
checklook(snum, actions);
|
2021-01-03 09:06:28 +00:00
|
|
|
p->apply_seasick(1);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-10-17 08:44:00 +00:00
|
|
|
if (p->on_crane != nullptr)
|
2020-05-19 07:03:07 +00:00
|
|
|
goto HORIZONLY;
|
|
|
|
|
2020-11-29 08:00:00 +00:00
|
|
|
p->playerweaponsway(s->xvel);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
s->xvel = clamp(ksqrt((p->pos.x - p->bobposx) * (p->pos.x - p->bobposx) + (p->pos.y - p->bobposy) * (p->pos.y - p->bobposy)), 0, 512);
|
2021-04-15 17:21:43 +00:00
|
|
|
if (p->on_ground) p->bobcounter += p->GetActor()->s->xvel >> 1;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2021-11-06 20:59:42 +00:00
|
|
|
p->backuppos(ud.clipping == 0 && (p->cursector()->floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
// Shrinking code
|
|
|
|
|
|
|
|
i = 40;
|
|
|
|
|
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;
|
2020-07-20 18:40:29 +00:00
|
|
|
tmp = getanimationgoal(anim_floorz, p->cursectnum);
|
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;
|
2020-11-15 11:07:30 +00:00
|
|
|
p->pyoff = bsin(p->pycount, -(p->SeaSick ? 2 : 7));
|
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
|
|
|
{
|
2020-08-29 11:32:14 +00:00
|
|
|
underwater(snum, actions, psect, fz, cz);
|
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
|
|
|
{
|
2020-08-29 11:32:14 +00:00
|
|
|
movement(snum, actions, psect, fz, cz, shrunk, truefdist, psectlotag);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
2020-08-05 12:57:47 +00:00
|
|
|
p->psectlotag = psectlotag;
|
|
|
|
|
2020-08-05 07:53:22 +00:00
|
|
|
//Do the quick lefts and rights
|
|
|
|
|
2021-01-02 00:04:03 +00:00
|
|
|
if (movementBlocked(p))
|
2020-08-05 07:53:22 +00:00
|
|
|
{
|
|
|
|
doubvel = 0;
|
|
|
|
p->posxv = 0;
|
|
|
|
p->posyv = 0;
|
|
|
|
}
|
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
|
|
|
|
|
2020-11-29 08:00:00 +00:00
|
|
|
sb_avel = p->adjustavel(sb_avel);
|
2021-04-21 10:41:04 +00:00
|
|
|
p->angle.applyinput(sb_avel, &actions);
|
2020-08-05 07:53:22 +00:00
|
|
|
}
|
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->spritebridge == 0)
|
|
|
|
{
|
2021-11-06 12:47:06 +00:00
|
|
|
int j = s->sector()->floorpicnum;
|
2020-05-19 07:03:07 +00:00
|
|
|
k = 0;
|
|
|
|
|
2020-11-29 12:54:58 +00:00
|
|
|
if (p->on_ground && truefdist <= gs.playerheight + (16 << 8))
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-08-07 21:30:08 +00:00
|
|
|
int whichsound = j == HURTRAIL ? 0 : j == FLOORSLIME ? 1 : j == FLOORPLASMA ? 2 :
|
|
|
|
(isRRRA() && (j == RRTILE7768 || j == RRTILE7820) ? 3 : -1);
|
2020-05-19 07:03:07 +00:00
|
|
|
if (j >= 0) k = makepainsounds(snum, whichsound);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k)
|
|
|
|
{
|
|
|
|
FTA(75, p);
|
|
|
|
p->boot_amount -= 2;
|
|
|
|
if (p->boot_amount <= 0)
|
|
|
|
checkavailinven(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->posxv || p->posyv || sb_fvel || sb_svel)
|
|
|
|
{
|
2020-08-27 05:54:49 +00:00
|
|
|
p->crack_time = CRACK_TIME;
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-11-15 11:07:30 +00:00
|
|
|
k = bsin(p->bobcounter, -12);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
if (isRRRA() && p->spritebridge == 0 && p->on_ground)
|
|
|
|
{
|
|
|
|
if (psectlotag == 1)
|
|
|
|
p->NotOnWater = 0;
|
|
|
|
else if (p->OnBoat)
|
|
|
|
{
|
|
|
|
if (psectlotag == 1234)
|
|
|
|
p->NotOnWater = 0;
|
|
|
|
else
|
|
|
|
p->NotOnWater = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p->NotOnWater = 1;
|
|
|
|
}
|
|
|
|
|
2020-11-29 12:54:58 +00:00
|
|
|
if (truefdist < gs.playerheight + (8 << 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)
|
|
|
|
{
|
2020-10-25 07:25:45 +00:00
|
|
|
int 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)
|
2021-04-15 17:21:43 +00:00
|
|
|
j = clz.actor->s->picnum;
|
2020-05-19 07:03:07 +00:00
|
|
|
else j = sector[psect].floorpicnum;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if ((krand() & 1) == 0)
|
2021-11-06 20:59:42 +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;
|
|
|
|
|
|
|
|
p->posxv += ((sb_fvel * doubvel) << 6);
|
|
|
|
p->posyv += ((sb_svel * doubvel) << 6);
|
|
|
|
|
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
|
|
|
{
|
2021-01-04 11:57:26 +00:00
|
|
|
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x2000, 16);
|
|
|
|
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x2000, 16);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (psectlotag == 2)
|
|
|
|
{
|
2021-01-04 11:57:26 +00:00
|
|
|
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1400, 16);
|
|
|
|
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1400, 16);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-04 11:57:26 +00:00
|
|
|
p->posxv = MulScale(p->posxv, gs.playerfriction, 16);
|
|
|
|
p->posyv = MulScale(p->posyv, gs.playerfriction, 16);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isRRRA() && sector[psect].floorpicnum == RRTILE7888)
|
|
|
|
{
|
|
|
|
if (p->OnMotorcycle)
|
|
|
|
if (p->on_ground)
|
|
|
|
p->moto_on_oil = 1;
|
|
|
|
}
|
|
|
|
else if (isRRRA() && sector[psect].floorpicnum == RRTILE7889)
|
|
|
|
{
|
|
|
|
if (p->OnMotorcycle)
|
|
|
|
{
|
|
|
|
if (p->on_ground)
|
|
|
|
p->moto_on_mud = 1;
|
|
|
|
}
|
|
|
|
else if (p->boot_amount > 0)
|
|
|
|
p->boot_amount--;
|
|
|
|
else
|
|
|
|
{
|
2021-01-04 11:57:26 +00:00
|
|
|
p->posxv = MulScale(p->posxv, gs.playerfriction, 16);
|
|
|
|
p->posyv = MulScale(p->posyv, gs.playerfriction, 16);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
if (sector[psect].floorpicnum == RRTILE3073 || sector[psect].floorpicnum == RRTILE2702)
|
|
|
|
{
|
|
|
|
if (p->OnMotorcycle)
|
|
|
|
{
|
|
|
|
if (p->on_ground)
|
|
|
|
{
|
2021-01-04 11:57:26 +00:00
|
|
|
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1800, 16);
|
|
|
|
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1800, 16);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (p->boot_amount > 0)
|
|
|
|
p->boot_amount--;
|
|
|
|
else
|
|
|
|
{
|
2021-01-04 11:57:26 +00:00
|
|
|
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1800, 16);
|
|
|
|
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1800, 16);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (abs(p->posxv) < 2048 && abs(p->posyv) < 2048)
|
|
|
|
p->posxv = p->posyv = 0;
|
|
|
|
|
|
|
|
if (shrunk)
|
|
|
|
{
|
|
|
|
p->posxv =
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(p->posxv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
|
2020-05-19 07:03:07 +00:00
|
|
|
p->posyv =
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(p->posyv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HORIZONLY:
|
|
|
|
|
|
|
|
if (psectlotag == 1 || p->spritebridge == 1) i = (4L << 8);
|
|
|
|
else i = (20L << 8);
|
|
|
|
|
2021-11-06 20:59:42 +00:00
|
|
|
if (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)
|
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.x += p->posxv >> 14;
|
|
|
|
p->pos.y += p->posyv >> 14;
|
|
|
|
updatesector(p->pos.x, p->pos.y, &p->cursectnum);
|
2021-08-27 14:38:53 +00:00
|
|
|
changeactorsect(pact, p->cursectnum);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
2021-10-31 06:52:52 +00:00
|
|
|
clipmove_ex(&p->pos.x, &p->pos.y,
|
|
|
|
&p->pos.z, &p->cursectnum,
|
2020-10-25 07:50:03 +00:00
|
|
|
p->posxv, p->posyv, 164L, (4L << 8), i, CLIPMASK0, clip);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
|
|
|
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.z += 32 << 8;
|
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
|
|
|
{
|
2020-10-25 07:50:03 +00:00
|
|
|
int var60 = wall[clip.index].lotag;
|
2020-10-25 07:25:45 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
if (p->OnMotorcycle)
|
|
|
|
{
|
2020-10-25 07:50:03 +00:00
|
|
|
onMotorcycleMove(snum, psect, clip.index);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else if (p->OnBoat)
|
|
|
|
{
|
2020-10-25 07:50:03 +00:00
|
|
|
onBoatMove(snum, psect, clip.index);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-25 07:50:03 +00:00
|
|
|
if (wall[clip.index].lotag >= 40 && wall[clip.index].lotag <= 44)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-10-25 07:50:03 +00:00
|
|
|
if (wall[clip.index].lotag < 44)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-10-25 07:50:03 +00:00
|
|
|
dofurniture(clip.index, p->cursectnum, snum);
|
2021-10-31 06:52:52 +00:00
|
|
|
pushmove(&p->pos.x, &p->pos.y, &p->pos.z, &p->cursectnum, 172L, (4L << 8), (4L << 8), CLIPMASK0);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else
|
2021-10-31 06:52:52 +00:00
|
|
|
pushmove(&p->pos.x, &p->pos.y, &p->pos.z, &p->cursectnum, 172L, (4L << 8), (4L << 8), 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)
|
|
|
|
{
|
2020-10-25 07:50:03 +00:00
|
|
|
onMotorcycleHit(snum, clip.actor);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else if (p->OnBoat)
|
|
|
|
{
|
2020-10-25 07:50:03 +00:00
|
|
|
onBoatHit(snum, clip.actor);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2020-11-05 06:30:56 +00:00
|
|
|
else if (badguy(clip.actor))
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (clip.actor->s->statnum != 1)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-11-05 06:30:56 +00:00
|
|
|
clip.actor->timetosleep = 0;
|
2021-04-15 17:21:43 +00:00
|
|
|
if (clip.actor->s->picnum == BILLYRAY)
|
2020-11-05 06:30:56 +00:00
|
|
|
S_PlayActorSound(404, clip.actor);
|
|
|
|
else
|
|
|
|
check_fta_sounds_r(clip.actor);
|
2021-08-27 14:25:58 +00:00
|
|
|
changeactorstat(clip.actor, 1);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2020-11-05 06:30:56 +00:00
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
else if (!isRRRA() && clip.actor->s->picnum == RRTILE3410)
|
2020-11-05 06:30:56 +00:00
|
|
|
{
|
|
|
|
quickkill(p);
|
|
|
|
S_PlayActorSound(446, pact);
|
|
|
|
}
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (clip.actor->s->picnum == RRTILE3410)
|
2020-11-05 06:30:56 +00:00
|
|
|
{
|
|
|
|
quickkill(p);
|
|
|
|
S_PlayActorSound(446, pact);
|
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
else if (clip.actor->s->picnum == RRTILE2443 && clip.actor->s->pal == 19)
|
2020-11-05 06:30:56 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
clip.actor->s->pal = 0;
|
2020-11-05 06:30:56 +00:00
|
|
|
p->DrugMode = 5;
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[snum].GetActor()->s->extra = gs.max_player_health;
|
2020-11-05 06:30:56 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (p->jetpack_on == 0)
|
|
|
|
{
|
|
|
|
if (s->xvel > 16)
|
|
|
|
{
|
|
|
|
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground && (!isRRRA() || !p->sea_sick_stat))
|
|
|
|
{
|
|
|
|
p->pycount += 52;
|
|
|
|
p->pycount &= 2047;
|
|
|
|
p->pyoff =
|
2020-11-15 11:07:30 +00:00
|
|
|
abs(s->xvel * bsin(p->pycount)) / 1596;
|
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***
|
2021-10-31 06:52:52 +00:00
|
|
|
setsprite(pact, p->pos.x, p->pos.y, p->pos.z + gs.playerheight);
|
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)
|
|
|
|
{
|
|
|
|
psect = s->sectnum;
|
2020-10-27 05:50:06 +00:00
|
|
|
if (ud.clipping == 0 && sector[psect].lotag == ST_31_TWO_WAY_TRAIN)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2020-11-04 18:04:20 +00:00
|
|
|
auto act = ScriptIndexToActor(sector[psect].hitag);
|
2021-04-15 17:21:43 +00:00
|
|
|
if (act && act->s->xvel && act->temp_data[0] == 0)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
quickkill(p);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-06 20:59:42 +00:00
|
|
|
if (truefdist < gs.playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && p->cursector()->lotag == 1)
|
2020-10-25 07:12:25 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER))
|
2021-11-06 20:59:42 +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
|
|
|
|
|
|
|
if (p->cursectnum != s->sectnum)
|
2021-08-27 14:38:53 +00:00
|
|
|
changeactorsect(pact, p->cursectnum);
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-10-25 07:50:03 +00:00
|
|
|
int j;
|
2020-05-19 07:03:07 +00:00
|
|
|
if (ud.clipping == 0)
|
|
|
|
{
|
|
|
|
if (s->clipdist == 64)
|
2021-10-31 06:52:52 +00:00
|
|
|
j = (pushmove(&p->pos.x, &p->pos.y, &p->pos.z, &p->cursectnum, 128L, (4L << 8), (4L << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
2020-05-19 07:03:07 +00:00
|
|
|
else
|
2021-10-31 06:52:52 +00:00
|
|
|
j = (pushmove(&p->pos.x, &p->pos.y, &p->pos.z, &p->cursectnum, 16L, (4L << 8), (4L << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
else j = 0;
|
|
|
|
|
|
|
|
if (ud.clipping == 0)
|
|
|
|
{
|
2020-10-25 07:12:25 +00:00
|
|
|
if (abs(pact->floorz - pact->ceilingz) < (48 << 8) || j)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-11-06 12:47:06 +00:00
|
|
|
if (!(s->sector()->lotag & 0x8000) && (isanunderoperator(s->sector()->lotag) ||
|
|
|
|
isanearoperator(s->sector()->lotag)))
|
2020-11-02 18:28:59 +00:00
|
|
|
fi.activatebysector(s->sectnum, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
if (j)
|
|
|
|
{
|
|
|
|
quickkill(p);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (abs(fz - cz) < (32 << 8) && isanunderoperator(sector[psect].lotag))
|
2020-11-02 18:28:59 +00:00
|
|
|
fi.activatebysector(psect, pact);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
2021-11-06 20:59:42 +00:00
|
|
|
if (ud.clipping == 0 && p->cursector()->ceilingz > (p->cursector()->floorz - (12 << 8)))
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
quickkill(p);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-08-27 22:03:35 +00:00
|
|
|
if (actions & SB_CENTERVIEW || p->hard_landing)
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
|
|
|
playerCenterView(snum);
|
|
|
|
}
|
2020-08-29 11:32:14 +00:00
|
|
|
else if (actions & 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
|
|
|
}
|
2020-08-29 11:32:14 +00:00
|
|
|
else if (actions & 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
|
|
|
}
|
2020-08-29 11:32:14 +00:00
|
|
|
else if ((actions & 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
|
|
|
}
|
2020-08-29 11:32:14 +00:00
|
|
|
else if ((actions & 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;
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.addadjustment(-d);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
2020-08-05 07:53:22 +00:00
|
|
|
|
2020-11-30 22:40:16 +00:00
|
|
|
if (SyncInput())
|
2020-05-19 07:03:07 +00:00
|
|
|
{
|
2021-05-02 20:37:46 +00:00
|
|
|
p->horizon.applyinput(GetPlayerHorizon(snum), &actions);
|
2020-05-19 07:03:07 +00:00
|
|
|
}
|
|
|
|
|
2020-11-29 08:00:00 +00:00
|
|
|
p->checkhardlanding();
|
2020-08-05 07:53:22 +00:00
|
|
|
|
2020-05-19 07:03:07 +00:00
|
|
|
//Shooting code/changes
|
|
|
|
|
|
|
|
if (p->show_empty_weapon > 0)
|
|
|
|
p->show_empty_weapon--;
|
|
|
|
|
|
|
|
if (p->show_empty_weapon == 1)
|
|
|
|
{
|
|
|
|
fi.addweapon(p, p->last_full_weapon);
|
|
|
|
return;
|
|
|
|
}
|
2020-10-23 17:50:18 +00:00
|
|
|
dokneeattack(snum, { FEM10, NAKED1, STATUE });
|
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;
|
2020-05-19 07:03:07 +00:00
|
|
|
// if(p->curr_weapon == KNEE_WEAPON) p->kickback_pic = 1;
|
|
|
|
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--;
|
|
|
|
}
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
processweapon(snum, actions, psect);
|
2020-05-19 07:54:52 +00:00
|
|
|
}
|
2020-05-19 07:03:07 +00:00
|
|
|
|
2020-05-22 06:56:42 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
void processmove_r(int snum, ESyncBits actions, int psect, int fz, int cz, int shrunk, int truefdist)
|
2020-05-19 16:32:28 +00:00
|
|
|
{
|
|
|
|
int psectlotag = sector[psect].lotag;
|
|
|
|
auto p = &ps[snum];
|
2020-08-07 19:59:11 +00:00
|
|
|
if (psectlotag == ST_2_UNDERWATER)
|
2020-05-19 16:32:28 +00:00
|
|
|
{
|
2020-08-29 11:32:14 +00:00
|
|
|
underwater(snum, actions, psect, fz, cz);
|
2020-05-19 16:32:28 +00:00
|
|
|
}
|
2020-08-07 19:59:11 +00:00
|
|
|
else
|
2020-05-19 16:32:28 +00:00
|
|
|
{
|
2020-08-29 11:32:14 +00:00
|
|
|
movement(snum, actions, psect, fz, cz, shrunk, truefdist, psectlotag);
|
2020-05-19 16:32:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-22 06:56:42 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-27 05:50:06 +00:00
|
|
|
void OnMotorcycle(struct player_struct *p, DDukeActor* motosprite)
|
2020-05-22 06:56:42 +00:00
|
|
|
{
|
2021-11-06 20:59:42 +00:00
|
|
|
if (!p->OnMotorcycle && !(p->cursector()->lotag == 2))
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
|
|
|
if (motosprite)
|
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.x = motosprite->s->x;
|
|
|
|
p->pos.y = motosprite->s->y;
|
2021-04-15 17:21:43 +00:00
|
|
|
p->angle.ang = buildang(motosprite->s->ang);
|
2020-10-28 06:30:17 +00:00
|
|
|
p->ammo_amount[MOTORCYCLE_WEAPON] = motosprite->saved_ammo;
|
2020-07-20 21:21:27 +00:00
|
|
|
deletesprite(motosprite);
|
|
|
|
}
|
|
|
|
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;
|
2020-07-20 21:21:27 +00:00
|
|
|
p->posxv = 0;
|
|
|
|
p->posyv = 0;
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.horiz = q16horiz(0);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OffMotorcycle(struct player_struct *p)
|
|
|
|
{
|
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);
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.horiz = q16horiz(0);
|
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;
|
|
|
|
p->posxv = 0;
|
|
|
|
p->posyv = 0;
|
2020-11-15 11:07:30 +00:00
|
|
|
p->posxv -= p->angle.ang.bcos(7);
|
|
|
|
p->posyv -= p->angle.ang.bsin(7);
|
2020-07-20 21:21:27 +00:00
|
|
|
p->moto_underwater = 0;
|
2020-10-23 19:53:39 +00:00
|
|
|
auto spawned = spawn(p->GetActor(), EMPTYBIKE);
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->ang = p->angle.ang.asbuild();
|
|
|
|
spawned->s->xvel += p->angle.ang.bcos(7);
|
|
|
|
spawned->s->yvel += p->angle.ang.bsin(7);
|
2020-10-28 06:30:17 +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
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-23 19:53:39 +00:00
|
|
|
void OnBoat(struct player_struct *p, DDukeActor* boat)
|
2020-05-22 06:56:42 +00:00
|
|
|
{
|
2020-07-20 21:21:27 +00:00
|
|
|
if (!p->OnBoat)
|
|
|
|
{
|
2020-10-23 19:53:39 +00:00
|
|
|
if (boat)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.x = boat->s->x;
|
|
|
|
p->pos.y = boat->s->y;
|
2021-04-15 17:21:43 +00:00
|
|
|
p->angle.ang = buildang(boat->s->ang);
|
2020-10-28 06:30:17 +00:00
|
|
|
p->ammo_amount[BOAT_WEAPON] = boat->saved_ammo;
|
2020-10-23 19:53:39 +00:00
|
|
|
deletesprite(boat);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
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;
|
2020-07-20 21:21:27 +00:00
|
|
|
p->posxv = 0;
|
|
|
|
p->posyv = 0;
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.horiz = q16horiz(0);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-05-22 06:56:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OffBoat(struct player_struct *p)
|
|
|
|
{
|
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);
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.horiz = q16horiz(0);
|
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;
|
|
|
|
p->posxv = 0;
|
|
|
|
p->posyv = 0;
|
2020-11-15 11:07:30 +00:00
|
|
|
p->posxv -= p->angle.ang.bcos(7);
|
|
|
|
p->posyv -= p->angle.ang.bsin(7);
|
2020-07-20 21:21:27 +00:00
|
|
|
p->moto_underwater = 0;
|
2020-10-23 19:53:39 +00:00
|
|
|
auto spawned = spawn(p->GetActor(), EMPTYBOAT);
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->ang = p->angle.ang.asbuild();
|
|
|
|
spawned->s->xvel += p->angle.ang.bcos(7);
|
|
|
|
spawned->s->yvel += p->angle.ang.bsin(7);
|
2020-10-28 06:30:17 +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
|