2020-05-14 10:14:03 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements)
|
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 Enhanced 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
|
|
|
|
|
|
|
|
EDuke enhancements integrated: 04/13/2003 - Matt Saettler
|
|
|
|
|
|
|
|
Note: EDuke source was in transition. Changes are in-progress in the
|
|
|
|
source as it is released.
|
|
|
|
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#include "ns.h"
|
|
|
|
#include "global.h"
|
2020-07-07 15:56:20 +00:00
|
|
|
#include "mapinfo.h"
|
2020-10-17 08:30:11 +00:00
|
|
|
#include "dukeactor.h"
|
2021-05-15 12:27:32 +00:00
|
|
|
#include "vm.h"
|
2020-05-14 10:14:03 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2020-07-15 16:10:31 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// callback for playercolor CVAR
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-23 18:48:48 +00:00
|
|
|
int playercolor2lookup(int color)
|
2020-07-15 16:10:31 +00:00
|
|
|
{
|
|
|
|
static int8_t player_pals[] = { 0, 9, 10, 11, 12, 13, 14, 15, 16, 21, 23, };
|
|
|
|
if (color >= 0 && color < 10) return player_pals[color];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PlayerColorChanged(void)
|
|
|
|
{
|
|
|
|
if (ud.recstat != 0)
|
|
|
|
return;
|
|
|
|
|
2020-10-23 17:33:54 +00:00
|
|
|
auto& pp = ps[myconnectindex];
|
2020-07-15 16:10:31 +00:00
|
|
|
if (ud.multimode > 1)
|
|
|
|
{
|
|
|
|
//Net_SendClientInfo();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-23 17:33:54 +00:00
|
|
|
pp.palookup = ud.user_pals[myconnectindex] = playercolor2lookup(playercolor);
|
2020-07-15 16:10:31 +00:00
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
if (pp.GetActor()->s->picnum == TILE_APLAYER && pp.GetActor()->s->pal != 1)
|
|
|
|
pp.GetActor()->s->pal = ud.user_pals[myconnectindex];
|
2020-07-15 16:10:31 +00:00
|
|
|
}
|
|
|
|
|
2020-05-16 21:55:21 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2020-07-03 14:17:37 +00:00
|
|
|
// why is this such a mess?
|
2020-05-16 21:55:21 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-05 06:16:29 +00:00
|
|
|
int setpal(struct player_struct* p)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-07-03 14:17:37 +00:00
|
|
|
int palette;
|
2020-05-16 21:55:21 +00:00
|
|
|
if (p->DrugMode) palette = DRUGPAL;
|
2020-07-03 14:17:37 +00:00
|
|
|
else if (p->heat_on) palette = SLIMEPAL;
|
2021-11-21 07:45:07 +00:00
|
|
|
else if (!p->insector()) palette = BASEPAL; // don't crash if out of range.
|
2021-11-21 07:56:39 +00:00
|
|
|
else if (p->cursector->ceilingpicnum >= TILE_FLOORSLIME && p->cursector->ceilingpicnum <= TILE_FLOORSLIME + 2) palette = SLIMEPAL;
|
|
|
|
else if (p->cursector->lotag == ST_2_UNDERWATER) palette = WATERPAL;
|
2020-05-16 21:55:21 +00:00
|
|
|
else palette = BASEPAL;
|
2020-11-05 06:16:29 +00:00
|
|
|
return palette;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void quickkill(struct player_struct* p)
|
|
|
|
{
|
|
|
|
SetPlayerPal(p, PalEntry(48, 48, 48, 48));
|
|
|
|
|
2020-10-23 17:50:18 +00:00
|
|
|
auto pa = p->GetActor();
|
2021-04-15 17:21:43 +00:00
|
|
|
pa->s->extra = 0;
|
|
|
|
pa->s->cstat |= 32768;
|
2020-10-23 17:50:18 +00:00
|
|
|
if (ud.god == 0) fi.guts(pa, TILE_JIBS6, 8, myconnectindex);
|
2020-05-16 21:55:21 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-09-20 10:01:05 +00:00
|
|
|
void forceplayerangle(int snum)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-09-20 10:01:05 +00:00
|
|
|
player_struct* p = &ps[snum];
|
2020-05-16 21:55:21 +00:00
|
|
|
int n;
|
|
|
|
|
|
|
|
n = 128 - (krand() & 255);
|
|
|
|
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.addadjustment(64);
|
2020-09-24 14:09:31 +00:00
|
|
|
p->sync.actions |= SB_CENTERVIEW;
|
2021-04-11 05:43:11 +00:00
|
|
|
p->angle.rotscrnang = p->angle.look_ang = buildang(n >> 1);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n)
|
|
|
|
{
|
|
|
|
int i, xv, yv, zv;
|
2021-11-18 18:04:00 +00:00
|
|
|
sectortype* sect = nullptr;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
|
|
|
i = n + 1;
|
|
|
|
xv = (x2 - x1) / i;
|
|
|
|
yv = (y2 - y1) / i;
|
|
|
|
zv = (z2 - z1) / i;
|
|
|
|
|
|
|
|
if ((abs(x1 - x2) + abs(y1 - y2)) < 3084)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = n; i > 0; i--)
|
|
|
|
{
|
|
|
|
x1 += xv;
|
|
|
|
y1 += yv;
|
|
|
|
z1 += zv;
|
|
|
|
updatesector(x1, y1, §);
|
2021-11-18 18:04:00 +00:00
|
|
|
if (sect)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-11-18 18:04:00 +00:00
|
|
|
if (sect->lotag == 2)
|
2020-11-02 19:23:48 +00:00
|
|
|
EGS(sect, x1, y1, z1, TILE_WATERBUBBLE, -32, 4 + (krand() & 3), 4 + (krand() & 3), krand() & 2047, 0, 0, ps[0].GetActor(), 5);
|
2020-05-16 21:55:21 +00:00
|
|
|
else
|
2020-11-02 19:23:48 +00:00
|
|
|
EGS(sect, x1, y1, z1, TILE_SMALLSMOKE, -32, 14, 14, 0, 0, 0, ps[0].GetActor(), 5);
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-23 17:33:54 +00:00
|
|
|
int hits(DDukeActor* actor)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto sp = actor->s;
|
2020-05-16 21:55:21 +00:00
|
|
|
int zoff;
|
2021-12-06 11:24:22 +00:00
|
|
|
HitInfo hit{};
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-04-15 08:02:16 +00:00
|
|
|
if (sp->picnum == TILE_APLAYER) zoff = isRR() ? PHEIGHT_RR : PHEIGHT_DUKE;
|
2020-05-16 21:55:21 +00:00
|
|
|
else zoff = 0;
|
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
hitscan(sp->pos, sp->sector(), { bcos(sp->ang), bsin(sp->ang), 0 }, hit, CLIPMASK1);
|
|
|
|
return (FindDistance2D(hit.hitpos.x - sp->x, hit.hitpos.y - sp->y));
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-23 17:33:54 +00:00
|
|
|
int hitasprite(DDukeActor* actor, DDukeActor** hitsp)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto sp = actor->s;
|
2021-11-25 23:08:59 +00:00
|
|
|
int zoff;
|
2021-12-06 11:24:22 +00:00
|
|
|
HitInfo hit{};
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-10-23 17:33:54 +00:00
|
|
|
if (badguy(actor))
|
2020-05-16 21:55:21 +00:00
|
|
|
zoff = (42 << 8);
|
|
|
|
else if (sp->picnum == TILE_APLAYER) zoff = (39 << 8);
|
|
|
|
else zoff = 0;
|
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
hitscan({ sp->x, sp->y, sp->z - zoff }, sp->sector(), { bcos(sp->ang), bsin(sp->ang), 0 }, hit, CLIPMASK1);
|
|
|
|
if (hitsp) *hitsp = hit.actor();
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitWall != nullptr && (hit.hitWall->cstat & 16) && badguy(actor))
|
2020-05-16 21:55:21 +00:00
|
|
|
return((1 << 30));
|
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
return (FindDistance2D(hit.hitpos.x - sp->x, hit.hitpos.y - sp->y));
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-17 23:04:36 +00:00
|
|
|
int hitawall(struct player_struct* p, walltype** hitw)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-12-06 11:24:22 +00:00
|
|
|
HitInfo hit{};
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
hitscan(p->pos, p->cursector, { p->angle.ang.bcos(), p->angle.ang.bsin(), 0 }, hit, CLIPMASK0);
|
|
|
|
if (hitw) *hitw = hit.hitWall;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
return (FindDistance2D(hit.hitpos.x - p->pos.x, hit.hitpos.y - p->pos.y));
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
DDukeActor* aim(DDukeActor* actor, int aang)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2021-11-07 11:53:48 +00:00
|
|
|
bool gotshrinker, gotfreezer;
|
2020-11-01 19:57:02 +00:00
|
|
|
int a, k, cans;
|
2020-07-26 07:06:08 +00:00
|
|
|
int aimstats[] = { STAT_PLAYER, STAT_DUMMYPLAYER, STAT_ACTOR, STAT_ZOMBIEACTOR };
|
2020-05-16 21:55:21 +00:00
|
|
|
int dx1, dy1, dx2, dy2, dx3, dy3, smax, sdist;
|
|
|
|
int xv, yv;
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
|
|
|
a = s->ang;
|
|
|
|
|
|
|
|
// Autoaim from DukeGDX.
|
2020-07-26 07:06:08 +00:00
|
|
|
if (s->picnum == TILE_APLAYER)
|
|
|
|
{
|
2020-11-29 08:00:00 +00:00
|
|
|
int autoaim = Autoaim(s->yvel);
|
|
|
|
if (!autoaim)
|
2020-07-26 07:06:08 +00:00
|
|
|
{
|
|
|
|
// The chickens in RRRA are homing and must always autoaim.
|
|
|
|
if (!isRRRA() || ps[s->yvel].curr_weapon != CHICKEN_WEAPON)
|
2020-11-01 19:57:02 +00:00
|
|
|
return nullptr;
|
2020-07-26 07:06:08 +00:00
|
|
|
}
|
2020-11-29 08:00:00 +00:00
|
|
|
else if (autoaim == 2)
|
2020-07-26 07:06:08 +00:00
|
|
|
{
|
|
|
|
int weap;
|
|
|
|
if (!isWW2GI())
|
|
|
|
{
|
|
|
|
weap = ps[s->yvel].curr_weapon;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-05 12:43:31 +00:00
|
|
|
weap = aplWeaponWorksLike(ps[s->yvel].curr_weapon, s->yvel);
|
2020-07-26 07:06:08 +00:00
|
|
|
}
|
|
|
|
if (weap > CHAINGUN_WEAPON || weap == KNEE_WEAPON)
|
|
|
|
{
|
2020-11-01 19:57:02 +00:00
|
|
|
return nullptr;
|
2020-07-26 07:06:08 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-07-26 07:06:08 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-01 19:57:02 +00:00
|
|
|
DDukeActor* aimed = nullptr;
|
2020-07-04 20:44:33 +00:00
|
|
|
// if(s->picnum == TILE_APLAYER && ps[s->yvel].aim_mode) return -1;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
|
|
|
if (isRR())
|
|
|
|
{
|
2021-11-07 11:53:48 +00:00
|
|
|
gotshrinker = false;
|
|
|
|
gotfreezer = false;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
else if (isWW2GI())
|
|
|
|
{
|
2021-12-05 12:43:31 +00:00
|
|
|
gotshrinker = s->picnum == TILE_APLAYER && aplWeaponWorksLike(ps[s->yvel].curr_weapon, s->yvel) == SHRINKER_WEAPON;
|
|
|
|
gotfreezer = s->picnum == TILE_APLAYER && aplWeaponWorksLike(ps[s->yvel].curr_weapon, s->yvel) == FREEZE_WEAPON;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gotshrinker = s->picnum == TILE_APLAYER && ps[s->yvel].curr_weapon == SHRINKER_WEAPON;
|
|
|
|
gotfreezer = s->picnum == TILE_APLAYER && ps[s->yvel].curr_weapon == FREEZE_WEAPON;
|
|
|
|
}
|
|
|
|
|
|
|
|
smax = 0x7fffffff;
|
|
|
|
|
2020-11-14 21:32:00 +00:00
|
|
|
dx1 = bcos(a - aang);
|
|
|
|
dy1 = bsin(a - aang);
|
|
|
|
dx2 = bcos(a + aang);
|
|
|
|
dy2 = bsin(a + aang);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-11-14 21:32:00 +00:00
|
|
|
dx3 = bcos(a);
|
|
|
|
dy3 = bsin(a);
|
2020-05-16 21:55:21 +00:00
|
|
|
|
|
|
|
for (k = 0; k < 4; k++)
|
|
|
|
{
|
2020-11-01 19:57:02 +00:00
|
|
|
if (aimed)
|
2020-05-16 21:55:21 +00:00
|
|
|
break;
|
2020-10-14 20:18:10 +00:00
|
|
|
|
2020-10-23 17:50:18 +00:00
|
|
|
DukeStatIterator it(aimstats[k]);
|
|
|
|
while (auto act = it.Next())
|
2020-10-14 20:18:10 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto sp = act->s;
|
2020-10-14 20:18:10 +00:00
|
|
|
if (sp->xrepeat > 0 && sp->extra >= 0 && (sp->cstat & (257 + 32768)) == 257)
|
|
|
|
if (badguy(sp) || k < 2)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
2020-10-14 20:18:10 +00:00
|
|
|
if (badguy(sp) || sp->picnum == TILE_APLAYER)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
|
|
|
if (sp->picnum == TILE_APLAYER &&
|
|
|
|
(isRR() && ud.ffire == 0) &&
|
|
|
|
ud.coop == 1 &&
|
|
|
|
s->picnum == TILE_APLAYER &&
|
2020-10-14 20:18:10 +00:00
|
|
|
s != sp)
|
2020-05-16 21:55:21 +00:00
|
|
|
continue;
|
|
|
|
|
2020-11-29 12:54:58 +00:00
|
|
|
if (gotshrinker && sp->xrepeat < 30 && !(gs.actorinfo[sp->picnum].flags & SFLAG_SHRINKAUTOAIM)) continue;
|
2020-10-14 20:18:10 +00:00
|
|
|
if (gotfreezer && sp->pal == 1) continue;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
xv = (sp->x - s->x);
|
|
|
|
yv = (sp->y - s->y);
|
|
|
|
|
|
|
|
if ((dy1 * xv) <= (dx1 * yv))
|
|
|
|
if ((dy2 * xv) >= (dx2 * yv))
|
|
|
|
{
|
2021-01-04 11:57:26 +00:00
|
|
|
sdist = MulScale(dx3, xv, 14) + MulScale(dy3, yv, 14);
|
2020-05-16 21:55:21 +00:00
|
|
|
if (sdist > 512 && sdist < smax)
|
|
|
|
{
|
|
|
|
if (s->picnum == TILE_APLAYER)
|
2021-01-04 12:34:55 +00:00
|
|
|
a = (abs(Scale(sp->z - s->z, 10, sdist) - ps[s->yvel].horizon.sum().asbuild()) < 100);
|
2020-05-16 21:55:21 +00:00
|
|
|
else a = 1;
|
|
|
|
|
2021-11-21 08:05:58 +00:00
|
|
|
cans = cansee(sp->x, sp->y, sp->z - (32 << 8) + gs.actorinfo[sp->picnum].aimoffset, sp->sector(), s->x, s->y, s->z - (32 << 8), s->sector());
|
2020-05-16 21:55:21 +00:00
|
|
|
|
|
|
|
if (a && cans)
|
|
|
|
{
|
|
|
|
smax = sdist;
|
2020-11-01 19:57:02 +00:00
|
|
|
aimed = act;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-14 20:18:10 +00:00
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 19:57:02 +00:00
|
|
|
return aimed;
|
2020-05-16 21:55:21 +00:00
|
|
|
}
|
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-23 17:50:18 +00:00
|
|
|
void dokneeattack(int snum, const std::initializer_list<int> & respawnlist)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
|
|
|
|
if (p->knee_incs > 0)
|
|
|
|
{
|
|
|
|
p->knee_incs++;
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.addadjustment(-48);
|
2020-09-24 14:09:31 +00:00
|
|
|
p->sync.actions |= SB_CENTERVIEW;
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->knee_incs > 15)
|
|
|
|
{
|
|
|
|
p->knee_incs = 0;
|
|
|
|
p->holster_weapon = 0;
|
|
|
|
if (p->weapon_pos < 0)
|
|
|
|
p->weapon_pos = -p->weapon_pos;
|
2020-10-23 17:50:18 +00:00
|
|
|
if (p->actorsqu != nullptr && dist(p->GetActor(), p->actorsqu) < 1400)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-22 17:21:21 +00:00
|
|
|
fi.guts(p->actorsqu, TILE_JIBS6, 7, myconnectindex);
|
2020-10-23 17:50:18 +00:00
|
|
|
spawn(p->actorsqu, TILE_BLOODPOOL);
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlayActorSound(SQUISHED, p->actorsqu);
|
2021-04-15 17:21:43 +00:00
|
|
|
if (isIn(p->actorsqu->s->picnum, respawnlist))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (p->actorsqu->s->yvel)
|
|
|
|
fi.operaterespawns(p->actorsqu->s->yvel);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
if (p->actorsqu->s->picnum == TILE_APLAYER)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
quickkill(&ps[p->actorsqu->s->yvel]);
|
|
|
|
ps[p->actorsqu->s->yvel].frag_ps = snum;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
else if (badguy(p->actorsqu->s))
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
deletesprite(p->actorsqu);
|
|
|
|
p->actors_killed++;
|
|
|
|
}
|
|
|
|
else deletesprite(p->actorsqu);
|
|
|
|
}
|
2020-10-17 08:30:11 +00:00
|
|
|
p->actorsqu = nullptr;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
int makepainsounds(int snum, int type)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-23 17:50:18 +00:00
|
|
|
auto actor = p->GetActor();
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-05-17 21:44:53 +00:00
|
|
|
int k = 0;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (rnd(32))
|
|
|
|
{
|
|
|
|
if (p->boot_amount > 0)
|
|
|
|
k = 1;
|
|
|
|
else
|
|
|
|
{
|
2020-10-23 17:50:18 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(actor, DUKE_LONGTERM_PAIN))
|
|
|
|
S_PlayActorSound(DUKE_LONGTERM_PAIN, actor);
|
2020-05-17 21:44:53 +00:00
|
|
|
SetPlayerPal(p, PalEntry(32, 64, 64, 64));
|
|
|
|
s->extra -= 1 + (krand() & 3);
|
2020-10-23 17:50:18 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(actor, SHORT_CIRCUIT))
|
|
|
|
S_PlayActorSound(SHORT_CIRCUIT, actor);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (rnd(16))
|
|
|
|
{
|
|
|
|
if (p->boot_amount > 0)
|
|
|
|
k = 1;
|
|
|
|
else
|
|
|
|
{
|
2020-10-23 17:50:18 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(actor, DUKE_LONGTERM_PAIN))
|
|
|
|
S_PlayActorSound(DUKE_LONGTERM_PAIN, actor);
|
2020-05-17 21:44:53 +00:00
|
|
|
SetPlayerPal(p, PalEntry(32, 0, 8, 0));
|
|
|
|
s->extra -= 1 + (krand() & 3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (rnd(32))
|
|
|
|
{
|
|
|
|
if (p->boot_amount > 0)
|
|
|
|
k = 1;
|
|
|
|
else
|
|
|
|
{
|
2020-10-23 17:50:18 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(actor, DUKE_LONGTERM_PAIN))
|
|
|
|
S_PlayActorSound(DUKE_LONGTERM_PAIN, actor);
|
2020-05-17 21:44:53 +00:00
|
|
|
SetPlayerPal(p, PalEntry(32, 8, 0, 0));
|
|
|
|
s->extra -= 1 + (krand() & 3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if ((krand() & 3) == 1)
|
|
|
|
if (p->on_ground)
|
|
|
|
{
|
|
|
|
if (p->OnMotorcycle)
|
|
|
|
s->extra -= 2;
|
|
|
|
else
|
|
|
|
s->extra -= 4;
|
2020-10-23 17:50:18 +00:00
|
|
|
S_PlayActorSound(DUKE_LONGTERM_PAIN, actor);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return k;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void footprints(int snum)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-23 17:50:18 +00:00
|
|
|
auto actor = p->GetActor();
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
if (p->footprintcount > 0 && p->on_ground)
|
2021-12-18 12:23:08 +00:00
|
|
|
if ((p->cursector->floorstat & CSTAT_SECTOR_SLOPE) != 2)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-23 17:50:18 +00:00
|
|
|
int j = -1;
|
2021-11-21 08:05:58 +00:00
|
|
|
DukeSectIterator it(s->sector());
|
2020-10-23 17:50:18 +00:00
|
|
|
while (auto act = it.Next())
|
2020-10-14 19:16:54 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (act->s->picnum == TILE_FOOTPRINTS || act->s->picnum == TILE_FOOTPRINTS2 || act->s->picnum == TILE_FOOTPRINTS3 || act->s->picnum == TILE_FOOTPRINTS4)
|
2021-10-31 06:52:52 +00:00
|
|
|
if (abs(act->s->x - p->pos.x) < 384)
|
|
|
|
if (abs(act->s->y - p->pos.y) < 384)
|
2020-10-23 17:50:18 +00:00
|
|
|
{
|
|
|
|
j = 1;
|
2020-05-17 21:44:53 +00:00
|
|
|
break;
|
2020-10-23 17:50:18 +00:00
|
|
|
}
|
2020-10-14 19:16:54 +00:00
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
if (j < 0)
|
|
|
|
{
|
|
|
|
p->footprintcount--;
|
2021-11-21 07:56:39 +00:00
|
|
|
if (p->cursector->lotag == 0 && p->cursector->hitag == 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-10-23 17:50:18 +00:00
|
|
|
DDukeActor* fprint;
|
2020-05-17 21:44:53 +00:00
|
|
|
switch (krand() & 3)
|
|
|
|
{
|
2020-10-23 17:50:18 +00:00
|
|
|
case 0: fprint = spawn(actor, TILE_FOOTPRINTS); break;
|
|
|
|
case 1: fprint = spawn(actor, TILE_FOOTPRINTS2); break;
|
|
|
|
case 2: fprint = spawn(actor, TILE_FOOTPRINTS3); break;
|
|
|
|
default: fprint = spawn(actor, TILE_FOOTPRINTS4); break;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2021-11-19 11:32:12 +00:00
|
|
|
if (fprint)
|
|
|
|
{
|
|
|
|
fprint->s->pal = p->footprintpal;
|
|
|
|
fprint->s->shade = (int8_t)p->footprintshade;
|
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 17:14:41 +00:00
|
|
|
inline void backupplayer(player_struct* p)
|
|
|
|
{
|
2020-11-29 08:00:00 +00:00
|
|
|
p->backuppos();
|
2020-10-21 17:14:41 +00:00
|
|
|
p->angle.backup();
|
|
|
|
p->horizon.backup();
|
|
|
|
}
|
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
void playerisdead(int snum, int psectlotag, int fz, int cz)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-10-23 17:50:18 +00:00
|
|
|
auto actor = p->GetActor();
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
if (p->dead_flag == 0)
|
|
|
|
{
|
|
|
|
if (s->pal != 1)
|
|
|
|
{
|
|
|
|
SetPlayerPal(p, PalEntry(63, 63, 0, 0));
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.z -= (16 << 8);
|
2020-05-17 21:44:53 +00:00
|
|
|
s->z -= (16 << 8);
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
if (ud.recstat == 1 && ud.multimode < 2)
|
|
|
|
closedemowrite();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (s->pal != 1)
|
|
|
|
p->dead_flag = (512 - ((krand() & 1) << 10) + (krand() & 255) - 512) & 2047;
|
|
|
|
|
|
|
|
p->jetpack_on = 0;
|
2020-10-21 08:48:38 +00:00
|
|
|
p->holoduke_on = nullptr;
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2020-10-23 17:50:18 +00:00
|
|
|
if (!isRR())S_StopSound(DUKE_JETPACK_IDLE, actor);
|
|
|
|
S_StopSound(-1, actor, CHAN_VOICE);
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (s->pal != 1 && (s->cstat & 32768) == 0) s->cstat = 0;
|
|
|
|
|
|
|
|
if (ud.multimode > 1 && (s->pal != 1 || (s->cstat & 32768)))
|
|
|
|
{
|
|
|
|
if (p->frag_ps != snum)
|
|
|
|
{
|
|
|
|
ps[p->frag_ps].frag++;
|
2020-11-29 13:10:03 +00:00
|
|
|
ps[p->frag_ps].frags[snum]++;
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2020-11-29 08:00:00 +00:00
|
|
|
auto pname = PlayerName(p->frag_ps);
|
2020-05-17 21:44:53 +00:00
|
|
|
if (snum == screenpeek)
|
|
|
|
{
|
2020-07-21 19:32:38 +00:00
|
|
|
Printf(PRINT_NOTIFY, "Killed by %s", pname);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-07-21 19:32:38 +00:00
|
|
|
Printf(PRINT_NOTIFY, "Killed %s", pname);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else p->fraggedself++;
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
p->frag_ps = snum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (psectlotag == ST_2_UNDERWATER)
|
|
|
|
{
|
|
|
|
if (p->on_warping_sector == 0)
|
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
if (abs(p->pos.z - fz) > (gs.playerheight >> 1))
|
|
|
|
p->pos.z += 348;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->z -= 512;
|
|
|
|
s->zvel = -348;
|
|
|
|
}
|
|
|
|
|
2021-11-06 19:46:08 +00:00
|
|
|
Collision coll;
|
2021-11-26 12:41:15 +00:00
|
|
|
clipmove(p->pos, &p->cursector, 0, 0, 164, (4 << 8), (4 << 8), CLIPMASK0, coll);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
2020-07-29 22:24:27 +00:00
|
|
|
backupplayer(p);
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2020-10-07 06:12:37 +00:00
|
|
|
p->horizon.horizoff = p->horizon.horiz = q16horiz(0);
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2021-11-21 07:56:39 +00:00
|
|
|
updatesector(p->pos.x, p->pos.y, &p->cursector);
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2021-11-21 07:56:39 +00:00
|
|
|
pushmove(&p->pos, &p->cursector, 128L, (4 << 8), (20 << 8), CLIPMASK0);
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
if (fz > cz + (16 << 8) && s->pal != 1)
|
2021-10-31 06:52:52 +00:00
|
|
|
p->angle.rotscrnang = buildang(p->dead_flag + ((fz + p->pos.z) >> 7));
|
2020-05-17 21:44:53 +00:00
|
|
|
|
|
|
|
p->on_warping_sector = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
int endoflevel(int snum)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
|
|
|
|
// the fist puching the end-of-level thing...
|
|
|
|
p->fist_incs++;
|
|
|
|
if (p->fist_incs == 28)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
if (ud.recstat == 1) closedemowrite();
|
|
|
|
#endif
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(PIPEBOMB_EXPLODE);
|
2020-05-17 21:44:53 +00:00
|
|
|
SetPlayerPal(p, PalEntry(48, 64, 64, 64));
|
|
|
|
}
|
|
|
|
if (p->fist_incs > 42)
|
|
|
|
{
|
2020-07-07 15:56:20 +00:00
|
|
|
setnextmap(!!p->buttonpalette);
|
2020-05-17 21:44:53 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-18 22:26:07 +00:00
|
|
|
int timedexit(int snum)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
p->timebeforeexit--;
|
|
|
|
if (p->timebeforeexit == 26 * 5)
|
|
|
|
{
|
|
|
|
FX_StopAllSounds();
|
|
|
|
if (p->customexitsound >= 0)
|
|
|
|
{
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(p->customexitsound);
|
2020-05-17 21:44:53 +00:00
|
|
|
FTA(102, p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->timebeforeexit == 1)
|
|
|
|
{
|
2020-07-07 15:56:20 +00:00
|
|
|
setnextmap(false);
|
2020-05-18 22:26:07 +00:00
|
|
|
return true;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-05-18 22:26:07 +00:00
|
|
|
return false;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-18 06:26:09 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
void playerCrouch(int snum)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
// crouching
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
2020-11-01 16:57:40 +00:00
|
|
|
OnEvent(EVENT_CROUCH, snum, p->GetActor(), -1);
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
p->pos.z += (2048 + 768);
|
2020-08-27 05:54:49 +00:00
|
|
|
p->crack_time = CRACK_TIME;
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void playerJump(int snum, int fz, int cz)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
if (p->jumping_toggle == 0 && p->jumping_counter == 0)
|
|
|
|
{
|
|
|
|
if ((fz - cz) > (56 << 8))
|
|
|
|
{
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
2020-11-01 16:57:40 +00:00
|
|
|
OnEvent(EVENT_JUMP, snum, p->GetActor(), -1);
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
|
|
|
p->jumping_counter = 1;
|
|
|
|
p->jumping_toggle = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-17 01:00:43 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-29 08:00:00 +00:00
|
|
|
void player_struct::apply_seasick(double factor)
|
2020-07-17 01:00:43 +00:00
|
|
|
{
|
2021-10-08 17:21:29 +00:00
|
|
|
if (isRRRA() && SeaSick && (dead_flag == 0 || (dead_flag && resurrected)))
|
2020-07-17 01:00:43 +00:00
|
|
|
{
|
2020-11-29 08:00:00 +00:00
|
|
|
if (SeaSick < 250)
|
2020-07-17 01:00:43 +00:00
|
|
|
{
|
2020-11-29 08:00:00 +00:00
|
|
|
if (SeaSick >= 180)
|
2021-04-21 10:41:04 +00:00
|
|
|
angle.rotscrnang += buildfang(24 * factor);
|
2020-11-29 08:00:00 +00:00
|
|
|
else if (SeaSick >= 130)
|
2021-04-21 10:41:04 +00:00
|
|
|
angle.rotscrnang -= buildfang(24 * factor);
|
2020-11-29 08:00:00 +00:00
|
|
|
else if (SeaSick >= 70)
|
2021-04-21 10:41:04 +00:00
|
|
|
angle.rotscrnang += buildfang(24 * factor);
|
2020-11-29 08:00:00 +00:00
|
|
|
else if (SeaSick >= 20)
|
2021-04-21 10:41:04 +00:00
|
|
|
angle.rotscrnang -= buildfang(24 * factor);
|
2020-07-17 01:00:43 +00:00
|
|
|
}
|
2020-11-29 08:00:00 +00:00
|
|
|
if (SeaSick < 250)
|
2021-04-21 10:41:04 +00:00
|
|
|
angle.look_ang = buildfang(((krand() & 255) - 128) * factor);
|
2020-08-05 12:57:47 +00:00
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
|
2020-07-17 01:00:43 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-29 08:00:00 +00:00
|
|
|
void player_struct::backuppos(bool noclipping)
|
2020-07-29 22:24:27 +00:00
|
|
|
{
|
2020-07-29 22:49:01 +00:00
|
|
|
if (!noclipping)
|
2020-07-29 22:24:27 +00:00
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
oposx = pos.x;
|
|
|
|
oposy = pos.y;
|
2020-07-29 22:24:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
pos.x = oposx;
|
|
|
|
pos.y = oposy;
|
2020-07-29 22:24:27 +00:00
|
|
|
}
|
|
|
|
|
2021-10-31 06:52:52 +00:00
|
|
|
oposz = pos.z;
|
|
|
|
bobposx = pos.x;
|
|
|
|
bobposy = pos.y;
|
2020-11-29 08:00:00 +00:00
|
|
|
opyoff = pyoff;
|
2020-07-29 22:24:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-29 08:00:00 +00:00
|
|
|
void player_struct::backupweapon()
|
2020-08-03 03:28:16 +00:00
|
|
|
{
|
2020-11-29 08:00:00 +00:00
|
|
|
oweapon_sway = weapon_sway;
|
|
|
|
oweapon_pos = weapon_pos;
|
|
|
|
okickback_pic = kickback_pic;
|
|
|
|
orandom_club_frame = random_club_frame;
|
|
|
|
ohard_landing = hard_landing;
|
2020-08-03 03:28:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-29 08:00:00 +00:00
|
|
|
void player_struct::checkhardlanding()
|
2020-08-05 07:53:22 +00:00
|
|
|
{
|
2020-11-29 08:00:00 +00:00
|
|
|
if (hard_landing > 0)
|
2020-08-05 07:53:22 +00:00
|
|
|
{
|
2020-11-29 08:00:00 +00:00
|
|
|
horizon.addadjustment(-(hard_landing << 4));
|
|
|
|
hard_landing--;
|
2020-08-05 07:53:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-29 08:00:00 +00:00
|
|
|
void player_struct::playerweaponsway(int xvel)
|
2020-08-05 10:04:14 +00:00
|
|
|
{
|
|
|
|
if (cl_weaponsway)
|
|
|
|
{
|
2020-11-29 08:00:00 +00:00
|
|
|
if (xvel < 32 || on_ground == 0 || bobcounter == 1024)
|
2020-08-05 10:04:14 +00:00
|
|
|
{
|
2020-11-29 08:00:00 +00:00
|
|
|
if ((weapon_sway & 2047) > (1024 + 96))
|
|
|
|
weapon_sway -= 96;
|
|
|
|
else if ((weapon_sway & 2047) < (1024 - 96))
|
|
|
|
weapon_sway += 96;
|
|
|
|
else oweapon_sway = weapon_sway = 1024;
|
2020-08-05 10:04:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-29 08:00:00 +00:00
|
|
|
weapon_sway = bobcounter;
|
2020-08-05 10:04:14 +00:00
|
|
|
|
2020-11-29 08:00:00 +00:00
|
|
|
if ((bobcounter - oweapon_sway) > 256)
|
2020-08-05 10:04:14 +00:00
|
|
|
{
|
2020-11-29 08:00:00 +00:00
|
|
|
oweapon_sway = weapon_sway;
|
2020-08-05 10:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-05 07:53:22 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
void checklook(int snum, ESyncBits actions)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-05-18 06:26:09 +00:00
|
|
|
auto p = &ps[snum];
|
2020-07-17 01:00:43 +00:00
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
if ((actions & SB_LOOK_LEFT) && !p->OnMotorcycle)
|
2020-05-17 21:44:53 +00:00
|
|
|
{
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
2020-11-01 16:57:40 +00:00
|
|
|
OnEvent(EVENT_LOOKLEFT, snum, p->GetActor(), -1);
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() != 0)
|
2020-07-16 15:59:25 +00:00
|
|
|
{
|
2020-09-21 07:00:07 +00:00
|
|
|
actions &= ~SB_LOOK_LEFT;
|
2020-07-16 15:59:25 +00:00
|
|
|
}
|
2020-07-17 01:00:43 +00:00
|
|
|
}
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
if ((actions & SB_LOOK_RIGHT) && !p->OnMotorcycle)
|
2020-07-17 01:00:43 +00:00
|
|
|
{
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
2020-11-01 16:57:40 +00:00
|
|
|
OnEvent(EVENT_LOOKRIGHT, snum, p->GetActor(), -1);
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() != 0)
|
2020-07-17 01:00:43 +00:00
|
|
|
{
|
2020-09-21 07:00:07 +00:00
|
|
|
actions &= ~SB_LOOK_RIGHT;
|
2020-07-17 01:00:43 +00:00
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-10-07 12:13:21 +00:00
|
|
|
p->angle.backup();
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-05-18 06:26:09 +00:00
|
|
|
|
2020-07-17 01:00:43 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-18 06:26:09 +00:00
|
|
|
void playerCenterView(int snum)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
2020-11-01 16:57:40 +00:00
|
|
|
OnEvent(EVENT_RETURNTOCENTER, snum, p->GetActor(), -1);
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-09-24 14:09:31 +00:00
|
|
|
p->sync.actions |= SB_CENTERVIEW;
|
2020-09-20 10:01:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-09-24 14:09:31 +00:00
|
|
|
p->sync.actions &= ~SB_CENTERVIEW;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-28 22:57:07 +00:00
|
|
|
void playerLookUp(int snum, ESyncBits actions)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
2020-11-01 16:57:40 +00:00
|
|
|
OnEvent(EVENT_LOOKUP, snum, p->GetActor(), -1);
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-09-24 14:09:31 +00:00
|
|
|
p->sync.actions |= SB_CENTERVIEW;
|
2020-09-20 10:01:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-09-24 14:09:31 +00:00
|
|
|
p->sync.actions &= ~SB_LOOK_UP;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-28 22:57:07 +00:00
|
|
|
void playerLookDown(int snum, ESyncBits actions)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
2020-11-01 16:57:40 +00:00
|
|
|
OnEvent(EVENT_LOOKDOWN, snum, p->GetActor(), -1);
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-09-24 14:09:31 +00:00
|
|
|
p->sync.actions |= SB_CENTERVIEW;
|
2020-09-20 10:01:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-09-24 14:09:31 +00:00
|
|
|
p->sync.actions &= ~SB_LOOK_DOWN;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-28 22:57:07 +00:00
|
|
|
void playerAimUp(int snum, ESyncBits actions)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
2020-11-01 16:57:40 +00:00
|
|
|
OnEvent(EVENT_AIMUP, snum, p->GetActor(), -1);
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() != 0)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-09-24 14:09:31 +00:00
|
|
|
p->sync.actions &= ~SB_AIM_UP;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-28 22:57:07 +00:00
|
|
|
void playerAimDown(int snum, ESyncBits actions)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
2021-01-30 22:42:44 +00:00
|
|
|
OnEvent(EVENT_AIMDOWN, snum, p->GetActor(), -1); // due to a typo in WW2GI's CON files this is the same as EVENT_AIMUP.
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() != 0)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
2020-09-24 14:09:31 +00:00
|
|
|
p->sync.actions &= ~SB_AIM_DOWN;
|
2020-05-18 06:26:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-05 09:24:32 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2020-07-17 23:34:13 +00:00
|
|
|
//
|
|
|
|
// split out so that the weapon check can be done right.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-01-02 00:04:03 +00:00
|
|
|
bool movementBlocked(player_struct *p)
|
2020-07-17 23:34:13 +00:00
|
|
|
{
|
|
|
|
auto blockingweapon = [=]()
|
|
|
|
{
|
|
|
|
if (isRR()) return false;
|
2021-12-05 12:43:31 +00:00
|
|
|
if (isWW2GI()) return aplWeaponWorksLike(p->curr_weapon, p->GetPlayerNum()) == TRIPBOMB_WEAPON;
|
2020-07-17 23:34:13 +00:00
|
|
|
else return p->curr_weapon == TRIPBOMB_WEAPON;
|
|
|
|
};
|
|
|
|
|
|
|
|
auto weapondelay = [=]()
|
|
|
|
{
|
2021-12-05 12:43:31 +00:00
|
|
|
if (isWW2GI()) return aplWeaponFireDelay(p->curr_weapon, p->GetPlayerNum());
|
2020-07-17 23:34:13 +00:00
|
|
|
else return 4;
|
|
|
|
};
|
|
|
|
|
|
|
|
return (p->fist_incs ||
|
|
|
|
p->transporter_hold > 2 ||
|
|
|
|
p->hard_landing ||
|
|
|
|
p->access_incs > 0 ||
|
|
|
|
p->knee_incs > 0 ||
|
|
|
|
(blockingweapon() && p->kickback_pic > 1 && p->kickback_pic < weapondelay()));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-19 19:21:55 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-18 18:57:14 +00:00
|
|
|
int haskey(sectortype* sectp, int snum)
|
2020-05-19 19:21:55 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
2021-11-20 16:46:08 +00:00
|
|
|
if (!sectp->keyinfo)
|
2020-05-19 19:21:55 +00:00
|
|
|
return 1;
|
2021-11-20 16:46:08 +00:00
|
|
|
if (sectp->keyinfo > 6)
|
2020-05-19 19:21:55 +00:00
|
|
|
return 1;
|
2021-11-20 16:46:08 +00:00
|
|
|
int wk = sectp->keyinfo;
|
2020-05-19 19:21:55 +00:00
|
|
|
if (wk > 3)
|
|
|
|
wk -= 3;
|
|
|
|
|
|
|
|
if (p->keys[wk] == 1)
|
|
|
|
{
|
2021-11-20 16:46:08 +00:00
|
|
|
sectp->keyinfo = 0;
|
2020-05-19 19:21:55 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-10-20 23:03:38 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-23 17:50:18 +00:00
|
|
|
void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spritetype* const s = actor->s;
|
2021-11-21 08:05:58 +00:00
|
|
|
auto sectp = s->sector();
|
2020-10-20 23:03:38 +00:00
|
|
|
int zvel;
|
2021-12-06 11:24:22 +00:00
|
|
|
HitInfo hit{};
|
2020-10-20 23:03:38 +00:00
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
sa += 64 - (krand() & 127);
|
|
|
|
else sa += 1024 + 64 - (krand() & 127);
|
|
|
|
zvel = 1024 - (krand() & 2047);
|
|
|
|
|
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
hitscan({ sx, sy, sz }, sectp, { bcos(sa), bsin(sa), zvel << 6 }, hit, CLIPMASK1);
|
2020-10-20 23:03:38 +00:00
|
|
|
|
|
|
|
// oh my...
|
2021-11-25 23:08:59 +00:00
|
|
|
if (FindDistance2D(sx - hit.hitpos.x, sy - hit.hitpos.y) < 1024 &&
|
|
|
|
(hit.hitWall != nullptr && hit.hitWall->overpicnum != BIGFORCE) &&
|
|
|
|
((hit.hitWall->twoSided() && hit.hitSector != nullptr &&
|
|
|
|
hit.hitWall->nextSector()->lotag == 0 &&
|
|
|
|
hit.hitSector->lotag == 0 &&
|
|
|
|
(hit.hitSector->floorz - hit.hitWall->nextSector()->floorz) > (16 << 8)) ||
|
|
|
|
(!hit.hitWall->twoSided() && hit.hitSector->lotag == 0)))
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-11-25 23:08:59 +00:00
|
|
|
if ((hit.hitWall->cstat & 16) == 0)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitWall->twoSided())
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-11-25 23:08:59 +00:00
|
|
|
DukeSectIterator it(hit.hitWall->nextSector());
|
2020-10-23 17:50:18 +00:00
|
|
|
while (auto act2 = it.Next())
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (act2->s->statnum == STAT_EFFECTOR && act2->s->lotag == SE_13_EXPLOSIVE)
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitWall->twoSided() &&
|
|
|
|
hit.hitWall->nextWall()->hitag != 0)
|
2020-10-20 23:03:38 +00:00
|
|
|
return;
|
|
|
|
|
2021-11-25 23:08:59 +00:00
|
|
|
if (hit.hitWall->hitag == 0)
|
2020-10-20 23:03:38 +00:00
|
|
|
{
|
2020-10-23 20:06:02 +00:00
|
|
|
auto spawned = spawn(actor, atwith);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (spawned)
|
|
|
|
{
|
|
|
|
spawned->s->xvel = -12;
|
2021-11-25 23:08:59 +00:00
|
|
|
auto delta = hit.hitWall->delta();
|
2021-11-19 11:32:12 +00:00
|
|
|
spawned->s->ang = getangle(-delta.x, -delta.y) + 512; // note the '-' sign here!
|
2021-11-25 23:08:59 +00:00
|
|
|
spawned->s->x = hit.hitpos.x;
|
|
|
|
spawned->s->y = hit.hitpos.y;
|
|
|
|
spawned->s->z = hit.hitpos.z;
|
2021-11-19 11:32:12 +00:00
|
|
|
spawned->s->cstat |= (krand() & 4);
|
|
|
|
ssp(spawned, CLIPMASK0);
|
2021-11-26 20:52:01 +00:00
|
|
|
SetActor(spawned, spawned->s->pos);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (s->picnum == OOZFILTER || s->picnum == NEWBEAST)
|
|
|
|
spawned->s->pal = 6;
|
|
|
|
}
|
2020-10-20 23:03:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-15 12:27:32 +00:00
|
|
|
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, gotweapon)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, pals)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, weapon_sway)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, oweapon_sway)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, weapon_pos)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, kickback_pic)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, random_club_frame)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, oweapon_pos)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, okickback_pic)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, orandom_club_frame)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, hard_landing)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, ohard_landing)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, psectlotag)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, exitx)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, exity)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, loogiex)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, loogiey)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, numloogs)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, loogcnt)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, invdisptime)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, bobposx)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, bobposy)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, oposx)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, oposy)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, oposz)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, pyoff)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, opyoff)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, posxv)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, posyv)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, poszv)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, last_pissed_time)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, truefz)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, truecz)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, player_par)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, visibility)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, bobcounter)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, randomflamex)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, crack_time)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, aim_mode)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, ftt)
|
2021-11-21 07:56:39 +00:00
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, cursector)
|
2021-05-15 12:27:32 +00:00
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, last_extra)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, subweapon)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, ammo_amount)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, frag)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, fraggedself)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, curr_weapon)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, last_weapon)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, tipincs)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, wantweaponfire)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, holoduke_amount)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, hurt_delay)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, hbomb_hold_delay)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, jumping_counter)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, airleft)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, knee_incs)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, access_incs)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, ftq)
|
2021-11-17 23:20:39 +00:00
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, access_wall)
|
2021-05-15 12:27:32 +00:00
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, got_access)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, weapon_ang)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, firstaid_amount)
|
2021-11-28 08:16:50 +00:00
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, actor)
|
2021-05-15 12:27:32 +00:00
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, one_parallax_sectnum)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, over_shoulder_on)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, fist_incs)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, cheat_phase)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, extra_extra8)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, quick_kick)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, last_quick_kick)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, heat_amount)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, timebeforeexit)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, customexitsound)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, weaprecs)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, weapreccnt)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, interface_toggle_flag)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, dead_flag)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, show_empty_weapon)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, scuba_amount)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, jetpack_amount)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, steroids_amount)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, shield_amount)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, pycount)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, frag_ps)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, transporter_hold)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, last_full_weapon)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, footprintshade)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, boot_amount)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, on_warping_sector)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, footprintcount)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, hbomb_on)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, jumping_toggle)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, rapid_fire_hold)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, on_ground)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, inven_icon)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, buttonpalette)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, jetpack_on)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, spritebridge)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, lastrandomspot)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, scuba_on)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, footprintpal)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, heat_on)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, holster_weapon)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, falling_counter)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, refresh_inventory)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, toggle_key_flag)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, knuckle_incs)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, walking_snd_toggle)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, palookup)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, quick_kick_msg)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, max_secret_rooms)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, secret_rooms)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, max_actors_killed)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, actors_killed)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, resurrected)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, stairs)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, detonate_count)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, noise_x)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, noise_y)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, noise_radius)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, drink_timer)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, eat_timer)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, SlotWin)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, recoil)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, detonate_time)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, yehaa_timer)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, drink_amt)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, eat)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, drunkang)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, eatang)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, shotgun_state)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, donoise)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, keys)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, drug_aspect)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, drug_timer)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, SeaSick)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, MamaEnd)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, moto_drink)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, TiltStatus)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, oTiltStatus)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, VBumpNow)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, VBumpTarget)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, TurbCount)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, drug_stat)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, DrugMode)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, lotag800kill)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, sea_sick_stat)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, hurt_delay2)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, nocheat)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, OnMotorcycle)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, OnBoat)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, moto_underwater)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, NotOnWater)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, MotoOnGround)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, moto_do_bump)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, moto_bump_fast)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, moto_on_oil)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, moto_on_mud)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, vehForwardScale)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, vehReverseScale)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, MotoSpeed)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, vehTurnLeft)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, vehTurnRight)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, vehBraking)
|
|
|
|
DEFINE_FIELD_X(DukePlayer, player_struct, holoduke_on)
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(_DukePlayer, IsFrozen)
|
|
|
|
{
|
|
|
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
|
|
|
ACTION_RETURN_BOOL(self->GetActor()->s->pal == 1 && self->last_extra < 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(_DukePlayer, GetGameVar)
|
|
|
|
{
|
|
|
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
|
|
|
PARAM_STRING(name);
|
|
|
|
PARAM_INT(def);
|
2021-12-05 16:36:57 +00:00
|
|
|
ACTION_RETURN_INT(GetGameVar(name, def, self->GetActor(), self->GetPlayerNum()).safeValue());
|
2021-05-15 12:27:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(_Duke, GetViewPlayer)
|
|
|
|
{
|
|
|
|
ACTION_RETURN_POINTER(&ps[screenpeek]);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(_Duke, MaxPlayerHealth)
|
|
|
|
{
|
|
|
|
ACTION_RETURN_INT(gs.max_player_health);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(_Duke, MaxAmmoAmount)
|
|
|
|
{
|
|
|
|
PARAM_PROLOGUE;
|
|
|
|
PARAM_INT(weap);
|
|
|
|
int max = weap < 0 || weap >= MAX_WEAPONS ? 0 : gs.max_ammo_amount[weap];
|
|
|
|
ACTION_RETURN_INT(max);
|
|
|
|
}
|
|
|
|
|
2020-05-14 10:14:03 +00:00
|
|
|
END_DUKE_NS
|