2020-05-05 09:58:39 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements)
|
|
|
|
Copyright (C) 2017-2019 - Nuke.YKT
|
|
|
|
Copyright (C) 2020 - Christoph Oelckers
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
This file is a combination of code from the following sources:
|
|
|
|
- EDuke 2 by Matt Saettler
|
|
|
|
- JFDuke by Jonathon Fowler (jf@jonof.id.au),
|
|
|
|
- DukeGDX and RedneckGDX by Alexander Makarov-[M210] (m210-2007@mail.ru)
|
|
|
|
- Redneck Rampage reconstructed source by Nuke.YKT
|
|
|
|
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "ns.h"
|
|
|
|
#include "global.h"
|
2020-07-03 21:56:14 +00:00
|
|
|
#include "names.h"
|
2020-06-23 19:12:15 +00:00
|
|
|
#include "stats.h"
|
2020-07-06 11:26:26 +00:00
|
|
|
#include "constants.h"
|
2020-10-17 07:14:31 +00:00
|
|
|
#include "dukeactor.h"
|
2020-05-05 09:58:39 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2020-10-21 23:11:38 +00:00
|
|
|
int adjustfall(DDukeActor* s, int c);
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-06-30 15:30:48 +00:00
|
|
|
|
2020-07-06 11:26:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// this was once a macro
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 17:14:41 +00:00
|
|
|
void RANDOMSCRAP(DDukeActor* origin)
|
2020-07-06 11:26:26 +00:00
|
|
|
{
|
2020-07-20 21:21:27 +00:00
|
|
|
int r1 = krand(), r2 = krand(), r3 = krand(), r4 = krand(), r5 = krand(), r6 = krand(), r7 = krand();
|
|
|
|
int v = isRR() ? 16 : 48;
|
2020-10-21 17:14:41 +00:00
|
|
|
EGS(origin->s.sectnum,
|
|
|
|
origin->s.x + (r7 & 255) - 128, origin->s.y + (r6 & 255) - 128, origin->s.z - (8 << 8) - (r5 & 8191),
|
|
|
|
TILE_SCRAP6 + (r4 & 15), -8, v, v, r3 & 2047, (r2 & 63) + 64, -512 - (r1 & 2047), origin, 5);
|
2020-07-06 11:26:26 +00:00
|
|
|
}
|
|
|
|
|
2020-06-30 15:30:48 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// wrapper to ensure that if a sound actor is killed, the sound is stopped as well.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 17:14:41 +00:00
|
|
|
void deletesprite(DDukeActor *const actor)
|
2020-06-30 15:30:48 +00:00
|
|
|
{
|
2020-10-21 17:14:41 +00:00
|
|
|
if (actor->s.picnum == MUSICANDSFX && actor->temp_data[0] == 1)
|
|
|
|
S_StopSound(actor->s.lotag, actor);
|
2020-08-12 18:15:02 +00:00
|
|
|
else
|
2020-10-21 17:14:41 +00:00
|
|
|
S_RelinkActorSound(actor, nullptr);
|
|
|
|
::deletesprite(actor->GetIndex());
|
2020-06-30 15:30:48 +00:00
|
|
|
}
|
|
|
|
|
2020-05-05 14:33:23 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 16:42:47 +00:00
|
|
|
void addammo(int weapon, struct player_struct* player, int amount)
|
2020-05-05 14:33:23 +00:00
|
|
|
{
|
2020-10-21 16:42:47 +00:00
|
|
|
player->ammo_amount[weapon] += amount;
|
2020-05-05 14:33:23 +00:00
|
|
|
|
2020-11-29 12:54:58 +00:00
|
|
|
if (player->ammo_amount[weapon] > gs.max_ammo_amount[weapon])
|
|
|
|
player->ammo_amount[weapon] = gs.max_ammo_amount[weapon];
|
2020-05-05 13:25:59 +00:00
|
|
|
}
|
|
|
|
|
2020-05-05 20:07:54 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 16:42:47 +00:00
|
|
|
void checkavailinven(struct player_struct* player)
|
2020-05-05 20:07:54 +00:00
|
|
|
{
|
|
|
|
|
2020-10-21 16:42:47 +00:00
|
|
|
if (player->firstaid_amount > 0)
|
|
|
|
player->inven_icon = ICON_FIRSTAID;
|
|
|
|
else if (player->steroids_amount > 0)
|
|
|
|
player->inven_icon = ICON_STEROIDS;
|
|
|
|
else if (player->holoduke_amount > 0)
|
|
|
|
player->inven_icon = ICON_HOLODUKE;
|
|
|
|
else if (player->jetpack_amount > 0)
|
|
|
|
player->inven_icon = ICON_JETPACK;
|
|
|
|
else if (player->heat_amount > 0)
|
|
|
|
player->inven_icon = ICON_HEATS;
|
|
|
|
else if (player->scuba_amount > 0)
|
|
|
|
player->inven_icon = ICON_SCUBA;
|
|
|
|
else if (player->boot_amount > 0)
|
|
|
|
player->inven_icon = ICON_BOOTS;
|
|
|
|
else player->inven_icon = ICON_NONE;
|
2020-05-05 20:07:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 16:42:47 +00:00
|
|
|
void checkavailweapon(struct player_struct* player)
|
2020-05-05 20:07:54 +00:00
|
|
|
{
|
|
|
|
short i, snum;
|
|
|
|
int weap;
|
|
|
|
|
2020-10-21 16:42:47 +00:00
|
|
|
if (player->wantweaponfire >= 0)
|
2020-05-05 20:07:54 +00:00
|
|
|
{
|
2020-10-21 16:42:47 +00:00
|
|
|
weap = player->wantweaponfire;
|
|
|
|
player->wantweaponfire = -1;
|
2020-05-05 20:07:54 +00:00
|
|
|
|
2020-10-21 16:42:47 +00:00
|
|
|
if (weap == player->curr_weapon) return;
|
|
|
|
else if (player->gotweapon[weap] && player->ammo_amount[weap] > 0)
|
2020-05-05 20:07:54 +00:00
|
|
|
{
|
2020-10-21 16:42:47 +00:00
|
|
|
fi.addweapon(player, weap);
|
2020-05-05 20:07:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-21 16:42:47 +00:00
|
|
|
weap = player->curr_weapon;
|
|
|
|
if (player->gotweapon[weap] && player->ammo_amount[weap] > 0)
|
2020-05-05 20:07:54 +00:00
|
|
|
return;
|
|
|
|
|
2020-10-21 16:42:47 +00:00
|
|
|
snum = player->GetPlayerNum();
|
2020-05-05 20:07:54 +00:00
|
|
|
|
2020-05-09 09:44:50 +00:00
|
|
|
int max = MAX_WEAPON;
|
|
|
|
for (i = 0; i <= max; i++)
|
2020-05-05 20:07:54 +00:00
|
|
|
{
|
|
|
|
weap = ud.wchoice[snum][i];
|
|
|
|
if ((g_gameType & GAMEFLAG_SHAREWARE) && weap > 6) continue;
|
|
|
|
|
|
|
|
if (weap == 0) weap = max;
|
|
|
|
else weap--;
|
|
|
|
|
2020-10-21 16:42:47 +00:00
|
|
|
if (weap == MIN_WEAPON || (player->gotweapon[weap] && player->ammo_amount[weap] > 0))
|
2020-05-05 20:07:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-05-09 09:44:50 +00:00
|
|
|
if (i == MAX_WEAPON) weap = MIN_WEAPON;
|
2020-05-05 20:07:54 +00:00
|
|
|
|
|
|
|
// Found the weapon
|
|
|
|
|
2020-10-21 16:42:47 +00:00
|
|
|
player->last_weapon = player->curr_weapon;
|
|
|
|
player->random_club_frame = 0;
|
|
|
|
player->curr_weapon = weap;
|
2020-05-06 14:10:44 +00:00
|
|
|
if (isWW2GI())
|
2020-05-05 20:07:54 +00:00
|
|
|
{
|
2020-10-21 16:42:47 +00:00
|
|
|
SetGameVarID(g_iWeaponVarID, player->curr_weapon, player->GetActor(), snum); // snum is playerindex!
|
|
|
|
if (player->curr_weapon >= 0)
|
2020-05-05 20:07:54 +00:00
|
|
|
{
|
2020-10-21 16:42:47 +00:00
|
|
|
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[player->curr_weapon][snum], player->GetActor(), snum);
|
2020-05-05 20:07:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 16:42:47 +00:00
|
|
|
SetGameVarID(g_iWorksLikeVarID, -1, player->GetActor(), snum);
|
2020-05-05 20:07:54 +00:00
|
|
|
}
|
2020-11-01 16:57:40 +00:00
|
|
|
OnEvent(EVENT_CHANGEWEAPON, snum, player->GetActor(), -1);
|
2020-05-05 20:07:54 +00:00
|
|
|
}
|
|
|
|
|
2020-10-21 16:42:47 +00:00
|
|
|
player->okickback_pic = player->kickback_pic = 0;
|
|
|
|
if (player->holster_weapon == 1)
|
2020-05-05 20:07:54 +00:00
|
|
|
{
|
2020-10-21 16:42:47 +00:00
|
|
|
player->holster_weapon = 0;
|
|
|
|
player->weapon_pos = 10;
|
2020-05-05 20:07:54 +00:00
|
|
|
}
|
2020-10-21 16:42:47 +00:00
|
|
|
else player->weapon_pos = -1;
|
2020-05-05 20:07:54 +00:00
|
|
|
}
|
|
|
|
|
2020-05-05 22:08:08 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void clearcamera(player_struct* ps)
|
|
|
|
{
|
2020-11-02 23:20:51 +00:00
|
|
|
ps->newOwner = nullptr;
|
2020-05-05 22:08:08 +00:00
|
|
|
ps->posx = ps->oposx;
|
|
|
|
ps->posy = ps->oposy;
|
|
|
|
ps->posz = ps->oposz;
|
2020-10-07 12:13:21 +00:00
|
|
|
ps->angle.restore();
|
2020-05-05 22:08:08 +00:00
|
|
|
updatesector(ps->posx, ps->posy, &ps->cursectnum);
|
|
|
|
|
2020-10-21 17:38:53 +00:00
|
|
|
DukeStatIterator it(STAT_ACTOR);
|
|
|
|
while (auto k = it.Next())
|
2020-05-05 22:08:08 +00:00
|
|
|
{
|
2020-10-21 17:38:53 +00:00
|
|
|
if (k->s.picnum == TILE_CAMERA1)
|
|
|
|
k->s.yvel = 0;
|
2020-05-05 22:08:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 17:38:53 +00:00
|
|
|
int ssp(DDukeActor* const actor, unsigned int cliptype) //The set sprite function
|
2020-05-05 22:08:08 +00:00
|
|
|
{
|
2020-10-24 07:31:15 +00:00
|
|
|
Collision c;
|
2020-05-05 22:08:08 +00:00
|
|
|
|
2020-10-24 07:31:15 +00:00
|
|
|
return movesprite_ex(actor,
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(actor->s.xvel, bcos(actor->s.ang), 14),
|
|
|
|
MulScale(actor->s.xvel, bsin(actor->s.ang), 14), actor->s.zvel,
|
2020-10-24 07:31:15 +00:00
|
|
|
cliptype, c) == kHitNone;
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2020-05-05 22:08:08 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-05 22:08:08 +00:00
|
|
|
|
2020-10-24 07:40:10 +00:00
|
|
|
void insertspriteq(DDukeActor* const actor)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
|
|
|
if (spriteqamount > 0)
|
|
|
|
{
|
2020-10-24 07:40:10 +00:00
|
|
|
if (spriteq[spriteqloc] != nullptr)
|
|
|
|
{
|
|
|
|
// Why is this not deleted here?
|
|
|
|
// Also todo: Make list size a CVAR.
|
|
|
|
spriteq[spriteqloc]->s.xrepeat = 0;
|
|
|
|
// deletesprite(spriteq[spriteqloc]);
|
|
|
|
}
|
|
|
|
spriteq[spriteqloc] = actor;
|
2020-05-07 20:30:19 +00:00
|
|
|
spriteqloc = (spriteqloc + 1) % spriteqamount;
|
2020-05-05 22:08:08 +00:00
|
|
|
}
|
2020-10-24 07:40:10 +00:00
|
|
|
else actor->s.xrepeat = actor->s.yrepeat = 0;
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2020-05-05 22:08:08 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// consolidation of several nearly identical functions
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-05 22:08:08 +00:00
|
|
|
|
2020-10-24 07:35:43 +00:00
|
|
|
void lotsofstuff(DDukeActor* actor, int n, int spawntype)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2020-10-24 07:35:43 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
for (int i = n; i > 0; i--)
|
2020-05-05 22:08:08 +00:00
|
|
|
{
|
2020-10-24 07:35:43 +00:00
|
|
|
int r1 = krand(), r2 = krand(); // using the RANDCORRECT version from RR.
|
|
|
|
auto j = EGS(s->sectnum, s->x, s->y, s->z - (r2 % (47 << 8)), spawntype, -32, 8, 8, r1 & 2047, 0, 0, actor, 5);
|
|
|
|
j->s.cstat = krand() & 12;
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// movesector - why is this in actors.cpp?
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-24 08:04:10 +00:00
|
|
|
void ms(DDukeActor* const actor)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
|
|
|
//T1,T2 and T3 are used for all the sector moving stuff!!!
|
2020-05-05 22:08:08 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
short startwall, endwall, x;
|
|
|
|
int tx, ty;
|
2020-10-24 08:04:10 +00:00
|
|
|
auto s = &actor->s;
|
2020-05-05 22:08:08 +00:00
|
|
|
|
2021-01-04 11:36:54 +00:00
|
|
|
s->x += MulScale(s->xvel, bcos(s->ang), 14);
|
|
|
|
s->y += MulScale(s->xvel, bsin(s->ang), 14);
|
2020-05-05 22:08:08 +00:00
|
|
|
|
2020-10-24 08:04:10 +00:00
|
|
|
int j = actor->temp_data[1];
|
|
|
|
int k = actor->temp_data[2];
|
2020-05-05 22:08:08 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
startwall = sector[s->sectnum].wallptr;
|
|
|
|
endwall = startwall + sector[s->sectnum].wallnum;
|
|
|
|
for (x = startwall; x < endwall; x++)
|
|
|
|
{
|
|
|
|
rotatepoint(
|
|
|
|
0, 0,
|
|
|
|
msx[j], msy[j],
|
|
|
|
k & 2047, &tx, &ty);
|
2020-05-05 22:08:08 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
dragpoint(x, s->x + tx, s->y + ty);
|
2020-05-05 22:08:08 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
2020-05-06 14:10:44 +00:00
|
|
|
|
2020-05-06 19:11:36 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void movecyclers(void)
|
|
|
|
{
|
|
|
|
short q, j, x, t, s, * c;
|
|
|
|
walltype* wal;
|
|
|
|
char cshade;
|
|
|
|
|
|
|
|
for (q = numcyclers - 1; q >= 0; q--)
|
|
|
|
{
|
|
|
|
|
|
|
|
c = &cyclers[q][0];
|
|
|
|
s = c[0];
|
|
|
|
|
|
|
|
t = c[3];
|
2020-11-14 09:49:46 +00:00
|
|
|
j = t + bsin(c[1], -10);
|
2020-05-06 19:11:36 +00:00
|
|
|
cshade = c[2];
|
|
|
|
|
|
|
|
if (j < cshade) j = cshade;
|
|
|
|
else if (j > t) j = t;
|
|
|
|
|
|
|
|
c[1] += sector[s].extra;
|
|
|
|
if (c[5])
|
|
|
|
{
|
|
|
|
wal = &wall[sector[s].wallptr];
|
|
|
|
for (x = sector[s].wallnum; x > 0; x--, wal++)
|
|
|
|
if (wal->hitag != 1)
|
|
|
|
{
|
|
|
|
wal->shade = j;
|
|
|
|
|
2020-07-19 15:38:36 +00:00
|
|
|
if ((wal->cstat & CSTAT_WALL_BOTTOM_SWAP) && wal->nextwall >= 0)
|
2020-05-06 19:11:36 +00:00
|
|
|
wall[wal->nextwall].shade = j;
|
|
|
|
|
|
|
|
}
|
|
|
|
sector[s].floorshade = sector[s].ceilingshade = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void movedummyplayers(void)
|
|
|
|
{
|
2020-10-21 19:14:25 +00:00
|
|
|
int p;
|
2020-05-06 19:11:36 +00:00
|
|
|
|
2020-10-21 19:14:25 +00:00
|
|
|
DukeStatIterator iti(STAT_DUMMYPLAYER);
|
|
|
|
while (auto act = iti.Next())
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
2020-10-21 19:14:25 +00:00
|
|
|
if (!act->GetOwner()) continue;
|
|
|
|
p = act->GetOwner()->PlayerIndex();
|
|
|
|
auto spri = &act->s;
|
2020-05-06 19:11:36 +00:00
|
|
|
|
2020-10-21 19:14:25 +00:00
|
|
|
if ((!isRR() && ps[p].on_crane != nullptr) || sector[ps[p].cursectnum].lotag != 1 || ps->GetActor()->s.extra <= 0)
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
2020-10-25 06:21:33 +00:00
|
|
|
ps[p].dummyplayersprite = nullptr;
|
2020-10-21 19:14:25 +00:00
|
|
|
deletesprite(act);
|
2020-05-06 19:11:36 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ps[p].on_ground && ps[p].on_warping_sector == 1 && sector[ps[p].cursectnum].lotag == 1)
|
|
|
|
{
|
2020-10-12 20:00:19 +00:00
|
|
|
spri->cstat = CSTAT_SPRITE_BLOCK_ALL;
|
|
|
|
spri->z = sector[spri->sectnum].ceilingz + (27 << 8);
|
|
|
|
spri->ang = ps[p].angle.ang.asbuild();
|
2020-10-24 08:13:21 +00:00
|
|
|
if (act->temp_data[0] == 8)
|
|
|
|
act->temp_data[0] = 0;
|
|
|
|
else act->temp_data[0]++;
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-12 20:00:19 +00:00
|
|
|
if (sector[spri->sectnum].lotag != 2) spri->z = sector[spri->sectnum].floorz;
|
|
|
|
spri->cstat = (short)32768;
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 20:00:19 +00:00
|
|
|
spri->x += (ps[p].posx - ps[p].oposx);
|
|
|
|
spri->y += (ps[p].posy - ps[p].oposy);
|
2020-10-21 19:14:25 +00:00
|
|
|
setsprite(act, spri->pos);
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 19:14:25 +00:00
|
|
|
void moveplayers(void)
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
|
|
|
int otherx;
|
|
|
|
|
2020-10-21 19:14:25 +00:00
|
|
|
DukeStatIterator iti(STAT_PLAYER);
|
|
|
|
while (auto act = iti.Next())
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
2020-10-21 19:14:25 +00:00
|
|
|
int pn = act->PlayerIndex();
|
|
|
|
auto p = &ps[pn];
|
|
|
|
auto spri = &act->s;
|
2021-01-04 02:27:31 +00:00
|
|
|
|
2020-10-21 19:14:25 +00:00
|
|
|
if (act->GetOwner())
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
2020-11-02 23:20:51 +00:00
|
|
|
if (p->newOwner != nullptr) //Looking thru the camera
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
2020-10-24 08:13:21 +00:00
|
|
|
spri->x = p->oposx;
|
|
|
|
spri->y = p->oposy;
|
2021-01-05 19:20:55 +00:00
|
|
|
spri->z = p->oposz + gs.playerheight;
|
|
|
|
spri->backupz();
|
2020-10-24 08:13:21 +00:00
|
|
|
spri->ang = p->angle.oang.asbuild();
|
2020-10-21 19:14:25 +00:00
|
|
|
setsprite(act, spri->pos);
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ud.multimode > 1)
|
2020-10-21 19:14:25 +00:00
|
|
|
otherp = findotherplayer(pn, &otherx);
|
2020-05-06 19:11:36 +00:00
|
|
|
else
|
|
|
|
{
|
2020-10-21 19:14:25 +00:00
|
|
|
otherp = pn;
|
2020-05-06 19:11:36 +00:00
|
|
|
otherx = 0;
|
|
|
|
}
|
|
|
|
|
2020-10-21 19:14:25 +00:00
|
|
|
execute(act, pn, otherx);
|
2020-05-06 19:11:36 +00:00
|
|
|
|
|
|
|
if (ud.multimode > 1)
|
2020-10-21 19:14:25 +00:00
|
|
|
{
|
|
|
|
auto psp = ps[otherp].GetActor();
|
|
|
|
if (psp->s.extra > 0)
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
2020-10-21 19:14:25 +00:00
|
|
|
if (spri->yrepeat > 32 && psp->s.yrepeat < 32)
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
|
|
|
if (otherx < 1400 && p->knee_incs == 0)
|
|
|
|
{
|
|
|
|
p->knee_incs = 1;
|
|
|
|
p->weapon_pos = -1;
|
2020-10-17 08:30:11 +00:00
|
|
|
p->actorsqu = ps[otherp].GetActor();
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-21 19:14:25 +00:00
|
|
|
}
|
2020-05-06 19:11:36 +00:00
|
|
|
if (ud.god)
|
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
spri->extra = gs.max_player_health;
|
2020-10-24 08:13:21 +00:00
|
|
|
spri->cstat = 257;
|
2020-05-06 19:11:36 +00:00
|
|
|
if (!isWW2GI() && !isRR())
|
|
|
|
p->jetpack_amount = 1599;
|
|
|
|
}
|
|
|
|
|
2020-10-17 08:30:11 +00:00
|
|
|
if (p->actorsqu != nullptr)
|
2020-08-05 07:43:06 +00:00
|
|
|
{
|
2020-11-22 09:50:03 +00:00
|
|
|
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->actorsqu->s.x - p->posx, p->actorsqu->s.y - p->posy)) >> 2);
|
2020-08-05 07:43:06 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 08:13:21 +00:00
|
|
|
if (spri->extra > 0)
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
|
|
|
// currently alive...
|
|
|
|
|
2020-10-21 19:14:25 +00:00
|
|
|
act->SetHitOwner(act);
|
2020-05-06 19:11:36 +00:00
|
|
|
|
|
|
|
if (ud.god == 0)
|
2020-10-24 08:13:21 +00:00
|
|
|
if (fi.ceilingspace(spri->sectnum) || fi.floorspace(spri->sectnum))
|
2020-05-06 19:11:36 +00:00
|
|
|
quickkill(p);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-24 08:13:21 +00:00
|
|
|
p->posx = spri->x;
|
|
|
|
p->posy = spri->y;
|
|
|
|
p->posz = spri->z - (20 << 8);
|
2020-05-06 19:11:36 +00:00
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
p->newOwner = nullptr;
|
2020-08-05 07:43:06 +00:00
|
|
|
|
2020-10-21 08:52:51 +00:00
|
|
|
if (p->wackedbyactor != nullptr && p->wackedbyactor->s.statnum < MAXSTATUS)
|
2020-08-05 07:43:06 +00:00
|
|
|
{
|
2020-11-22 09:50:03 +00:00
|
|
|
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->wackedbyactor->s.x - p->posx, p->wackedbyactor->s.y - p->posy)) >> 1);
|
2020-08-05 07:43:06 +00:00
|
|
|
}
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
2020-10-24 08:13:21 +00:00
|
|
|
spri->ang = p->angle.ang.asbuild();
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 08:48:38 +00:00
|
|
|
if (p->holoduke_on == nullptr)
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
2020-10-21 19:14:25 +00:00
|
|
|
deletesprite(act);
|
2020-05-06 19:11:36 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-10-24 08:13:21 +00:00
|
|
|
spri->cstat = 0;
|
2020-05-06 19:11:36 +00:00
|
|
|
|
2020-10-24 08:13:21 +00:00
|
|
|
if (spri->xrepeat < 42)
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
2020-10-24 08:13:21 +00:00
|
|
|
spri->xrepeat += 4;
|
|
|
|
spri->cstat |= 2;
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
2020-10-24 08:13:21 +00:00
|
|
|
else spri->xrepeat = 42;
|
|
|
|
if (spri->yrepeat < 36)
|
|
|
|
spri->yrepeat += 4;
|
2020-05-06 19:11:36 +00:00
|
|
|
else
|
|
|
|
{
|
2020-10-24 08:13:21 +00:00
|
|
|
spri->yrepeat = 36;
|
|
|
|
if (sector[spri->sectnum].lotag != ST_2_UNDERWATER)
|
2020-10-21 19:14:25 +00:00
|
|
|
makeitfall(act);
|
2020-10-24 08:13:21 +00:00
|
|
|
if (spri->zvel == 0 && sector[spri->sectnum].lotag == ST_1_ABOVE_WATER)
|
|
|
|
spri->z += (32 << 8);
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 08:13:21 +00:00
|
|
|
if (spri->extra < 8)
|
2020-05-06 19:11:36 +00:00
|
|
|
{
|
2020-10-24 08:13:21 +00:00
|
|
|
spri->xvel = 128;
|
|
|
|
spri->ang = p->angle.ang.asbuild();
|
|
|
|
spri->extra++;
|
2020-10-21 19:14:25 +00:00
|
|
|
ssp(act, CLIPMASK0);
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-24 08:13:21 +00:00
|
|
|
spri->ang = 2047 - (p->angle.ang.asbuild());
|
2020-10-21 19:14:25 +00:00
|
|
|
setsprite(act, spri->pos);
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-24 08:13:21 +00:00
|
|
|
if (sector[spri->sectnum].ceilingstat & 1)
|
|
|
|
spri->shade += (sector[spri->sectnum].ceilingshade - spri->shade) >> 1;
|
2020-05-06 19:11:36 +00:00
|
|
|
else
|
2020-10-24 08:13:21 +00:00
|
|
|
spri->shade += (sector[spri->sectnum].floorshade - spri->shade) >> 1;
|
2020-05-06 19:11:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 07:49:05 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void movefx(void)
|
|
|
|
{
|
2020-10-24 08:30:17 +00:00
|
|
|
int p;
|
2020-05-07 07:49:05 +00:00
|
|
|
int x, ht;
|
|
|
|
|
2020-10-24 08:30:17 +00:00
|
|
|
DukeStatIterator iti(STAT_FX);
|
|
|
|
while (auto act = iti.Next())
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:30:17 +00:00
|
|
|
auto spri = &act->s;
|
2020-10-24 08:21:43 +00:00
|
|
|
switch (spri->picnum)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
|
|
|
case RESPAWN:
|
2020-10-24 08:21:43 +00:00
|
|
|
if (spri->extra == 66)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2020-10-24 08:30:17 +00:00
|
|
|
auto j = spawn(act, spri->hitag);
|
2020-10-12 20:05:22 +00:00
|
|
|
if (isRRRA())
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2020-10-24 08:30:17 +00:00
|
|
|
respawn_rrra(act, j);
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-24 08:30:17 +00:00
|
|
|
deletesprite(act);
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-24 08:21:43 +00:00
|
|
|
else if (spri->extra > (66 - 13))
|
|
|
|
spri->extra++;
|
2020-05-07 07:49:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MUSICANDSFX:
|
|
|
|
|
2020-10-24 08:21:43 +00:00
|
|
|
ht = spri->hitag;
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-24 08:21:43 +00:00
|
|
|
if (act->temp_data[1] != (int)SoundEnabled())
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:21:43 +00:00
|
|
|
act->temp_data[1] = SoundEnabled();
|
|
|
|
act->temp_data[0] = 0;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 08:21:43 +00:00
|
|
|
if (spri->lotag >= 1000 && spri->lotag < 2000)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:30:17 +00:00
|
|
|
x = ldist(ps[screenpeek].GetActor(), act);
|
2020-10-24 08:21:43 +00:00
|
|
|
if (x < ht && act->temp_data[0] == 0)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-12-01 15:34:47 +00:00
|
|
|
FX_SetReverb(spri->lotag - 1100);
|
2020-10-24 08:21:43 +00:00
|
|
|
act->temp_data[0] = 1;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
2020-10-24 08:21:43 +00:00
|
|
|
if (x >= ht && act->temp_data[0] == 1)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
|
|
|
FX_SetReverb(0);
|
|
|
|
FX_SetReverbDelay(0);
|
2020-10-24 08:21:43 +00:00
|
|
|
act->temp_data[0] = 0;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-24 08:21:43 +00:00
|
|
|
else if (spri->lotag < 999 && (unsigned)sector[spri->sectnum].lotag < ST_9_SLIDING_ST_DOOR && snd_ambience && sector[spri->sectnum].floorz != sector[spri->sectnum].ceilingz)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:30:17 +00:00
|
|
|
int flags = S_GetUserFlags(spri->lotag);
|
2020-05-07 07:49:05 +00:00
|
|
|
if (flags & SF_MSFX)
|
|
|
|
{
|
2020-10-24 08:30:17 +00:00
|
|
|
int x = dist(ps[screenpeek].GetActor(), act);
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-24 08:21:43 +00:00
|
|
|
if (x < ht && act->temp_data[0] == 0)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
|
|
|
// Start playing an ambience sound.
|
2020-10-24 08:30:17 +00:00
|
|
|
S_PlayActorSound(spri->lotag, act, CHAN_AUTO, CHANF_LOOP);
|
2020-10-24 08:21:43 +00:00
|
|
|
act->temp_data[0] = 1; // AMBIENT_SFX_PLAYING
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
2020-10-24 08:21:43 +00:00
|
|
|
else if (x >= ht && act->temp_data[0] == 1)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
|
|
|
// Stop playing ambience sound because we're out of its range.
|
2020-10-24 08:30:17 +00:00
|
|
|
S_StopSound(spri->lotag, act);
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((flags & (SF_GLOBAL | SF_DTAG)) == SF_GLOBAL)
|
|
|
|
{
|
2020-10-24 08:21:43 +00:00
|
|
|
if (act->temp_data[4] > 0) act->temp_data[4]--;
|
2020-05-07 07:49:05 +00:00
|
|
|
else for (p = connecthead; p >= 0; p = connectpoint2[p])
|
2020-10-24 08:21:43 +00:00
|
|
|
if (p == myconnectindex && ps[p].cursectnum == spri->sectnum)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:21:43 +00:00
|
|
|
S_PlaySound(spri->lotag + (unsigned)global_random % (spri->hitag + 1));
|
|
|
|
act->temp_data[4] = 26 * 40 + (global_random % (26 * 40));
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// split out of movestandables
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-24 08:37:20 +00:00
|
|
|
void movecrane(DDukeActor *actor, int crane)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:37:20 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
auto spri = &actor->s;
|
2020-10-24 08:32:21 +00:00
|
|
|
int sect = spri->sectnum;
|
2020-05-07 07:49:05 +00:00
|
|
|
int x;
|
|
|
|
|
|
|
|
//t[0] = state
|
|
|
|
//t[1] = checking sector number
|
|
|
|
|
2020-10-24 08:37:20 +00:00
|
|
|
if (spri->xvel) getglobalz(actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
|
|
|
|
if (t[0] == 0) //Waiting to check the sector
|
|
|
|
{
|
2020-10-24 08:37:20 +00:00
|
|
|
DukeSectIterator it(t[1]);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:37:20 +00:00
|
|
|
switch (a2->s.statnum)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
|
|
|
case STAT_ACTOR:
|
|
|
|
case STAT_ZOMBIEACTOR:
|
|
|
|
case STAT_STANDABLE:
|
|
|
|
case STAT_PLAYER:
|
2020-10-24 08:32:21 +00:00
|
|
|
spri->ang = getangle(msx[t[4] + 1] - spri->x, msy[t[4] + 1] - spri->y);
|
2020-10-24 08:37:20 +00:00
|
|
|
setsprite(a2, msx[t[4] + 1], msy[t[4] + 1], a2->s.z);
|
2020-05-07 07:49:05 +00:00
|
|
|
t[0]++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (t[0] == 1)
|
|
|
|
{
|
2020-10-24 08:32:21 +00:00
|
|
|
if (spri->xvel < 184)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:32:21 +00:00
|
|
|
spri->picnum = crane + 1;
|
|
|
|
spri->xvel += 8;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
//IFMOVING; // JBF 20040825: see my rant above about this
|
2020-10-24 08:37:20 +00:00
|
|
|
ssp(actor, CLIPMASK0);
|
2020-05-07 07:49:05 +00:00
|
|
|
if (sect == t[1])
|
|
|
|
t[0]++;
|
|
|
|
}
|
|
|
|
else if (t[0] == 2 || t[0] == 7)
|
|
|
|
{
|
2020-10-24 08:32:21 +00:00
|
|
|
spri->z += (1024 + 512);
|
2020-05-07 07:49:05 +00:00
|
|
|
|
|
|
|
if (t[0] == 2)
|
|
|
|
{
|
2020-10-24 08:32:21 +00:00
|
|
|
if ((sector[sect].floorz - spri->z) < (64 << 8))
|
|
|
|
if (spri->picnum > crane) spri->picnum--;
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-24 08:32:21 +00:00
|
|
|
if ((sector[sect].floorz - spri->z) < (4096 + 1024))
|
2020-05-07 07:49:05 +00:00
|
|
|
t[0]++;
|
|
|
|
}
|
|
|
|
if (t[0] == 7)
|
|
|
|
{
|
2020-10-24 08:32:21 +00:00
|
|
|
if ((sector[sect].floorz - spri->z) < (64 << 8))
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:32:21 +00:00
|
|
|
if (spri->picnum > crane) spri->picnum--;
|
2020-05-07 07:49:05 +00:00
|
|
|
else
|
|
|
|
{
|
2020-10-24 08:37:20 +00:00
|
|
|
if (actor->IsActiveCrane())
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:37:20 +00:00
|
|
|
int p = findplayer(actor, &x);
|
|
|
|
S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].GetActor());
|
|
|
|
if (ps[p].on_crane == actor)
|
2020-10-17 08:44:00 +00:00
|
|
|
ps[p].on_crane = nullptr;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
t[0]++;
|
2020-11-04 20:25:59 +00:00
|
|
|
actor->SetActiveCrane(false);
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (t[0] == 3)
|
|
|
|
{
|
2020-10-24 08:32:21 +00:00
|
|
|
spri->picnum++;
|
|
|
|
if (spri->picnum == (crane + 2))
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:37:20 +00:00
|
|
|
int p = checkcursectnums(t[1]);
|
2020-05-07 07:49:05 +00:00
|
|
|
if (p >= 0 && ps[p].on_ground)
|
|
|
|
{
|
2020-10-24 08:37:20 +00:00
|
|
|
actor->SetActiveCrane(true);
|
|
|
|
ps[p].on_crane = actor;
|
|
|
|
S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].GetActor());
|
2020-11-26 06:26:29 +00:00
|
|
|
ps[p].angle.settarget(spri->ang + 1024);
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-24 08:37:20 +00:00
|
|
|
DukeSectIterator it(t[1]);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:37:20 +00:00
|
|
|
switch (a2->s.statnum)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
case 6:
|
2020-10-24 08:37:20 +00:00
|
|
|
actor->SetOwner(a2);
|
2020-05-07 07:49:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
t[0]++;//Grabbed the sprite
|
|
|
|
t[2] = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (t[0] == 4) //Delay before going up
|
|
|
|
{
|
|
|
|
t[2]++;
|
|
|
|
if (t[2] > 10)
|
|
|
|
t[0]++;
|
|
|
|
}
|
|
|
|
else if (t[0] == 5 || t[0] == 8)
|
|
|
|
{
|
2020-10-24 08:32:21 +00:00
|
|
|
if (t[0] == 8 && spri->picnum < (crane + 2))
|
|
|
|
if ((sector[sect].floorz - spri->z) > 8192)
|
|
|
|
spri->picnum++;
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-24 08:32:21 +00:00
|
|
|
if (spri->z < msx[t[4] + 2])
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
|
|
|
t[0]++;
|
2020-10-24 08:32:21 +00:00
|
|
|
spri->xvel = 0;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
else
|
2020-10-24 08:32:21 +00:00
|
|
|
spri->z -= (1024 + 512);
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
else if (t[0] == 6)
|
|
|
|
{
|
2020-10-24 08:32:21 +00:00
|
|
|
if (spri->xvel < 192)
|
|
|
|
spri->xvel += 8;
|
|
|
|
spri->ang = getangle(msx[t[4]] - spri->x, msy[t[4]] - spri->y);
|
2020-10-24 08:37:20 +00:00
|
|
|
ssp(actor, CLIPMASK0);
|
2020-10-24 08:32:21 +00:00
|
|
|
if (((spri->x - msx[t[4]]) * (spri->x - msx[t[4]]) + (spri->y - msy[t[4]]) * (spri->y - msy[t[4]])) < (128 * 128))
|
2020-05-07 07:49:05 +00:00
|
|
|
t[0]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (t[0] == 9)
|
|
|
|
t[0] = 0;
|
|
|
|
|
2020-11-02 20:37:37 +00:00
|
|
|
setsprite(ScriptIndexToActor(msy[t[4] + 2]), spri->x, spri->y, spri->z - (34 << 8));
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-24 08:37:20 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
2020-11-04 20:25:59 +00:00
|
|
|
if (Owner != nullptr || actor->IsActiveCrane())
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 08:37:20 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
int j = fi.ifhitbyweapon(actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
2020-10-24 08:37:20 +00:00
|
|
|
if (actor->IsActiveCrane())
|
|
|
|
if (ps[p].on_crane == actor)
|
2020-10-17 08:44:00 +00:00
|
|
|
ps[p].on_crane = nullptr;
|
2020-10-24 08:37:20 +00:00
|
|
|
actor->SetActiveCrane(false);
|
2020-10-24 08:32:21 +00:00
|
|
|
spri->picnum = crane;
|
2020-05-07 07:49:05 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-11-04 20:25:59 +00:00
|
|
|
if (Owner != nullptr)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-11-04 20:25:59 +00:00
|
|
|
setsprite(Owner, spri->pos);
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2021-01-05 19:20:55 +00:00
|
|
|
Owner->s.opos = spri->pos;
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-24 08:32:21 +00:00
|
|
|
spri->zvel = 0;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
2020-10-24 08:37:20 +00:00
|
|
|
else if (actor->IsActiveCrane())
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-07 12:13:21 +00:00
|
|
|
auto ang = ps[p].angle.ang.asbuild();
|
2020-08-06 05:39:45 +00:00
|
|
|
ps[p].oposx = ps[p].posx;
|
|
|
|
ps[p].oposy = ps[p].posy;
|
|
|
|
ps[p].oposz = ps[p].posz;
|
2020-11-14 09:49:46 +00:00
|
|
|
ps[p].posx = spri->x - bcos(ang, -6);
|
|
|
|
ps[p].posy = spri->y - bsin(ang, -6);
|
2020-10-24 08:32:21 +00:00
|
|
|
ps[p].posz = spri->z + (2 << 8);
|
2020-10-24 08:37:20 +00:00
|
|
|
setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz);
|
|
|
|
ps[p].cursectnum = ps[p].GetActor()->s.sectnum;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 19:46:39 +00:00
|
|
|
void movefountain(DDukeActor *actor, int fountain)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 19:46:39 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-07 07:49:05 +00:00
|
|
|
int x;
|
|
|
|
if (t[0] > 0)
|
|
|
|
{
|
|
|
|
if (t[0] < 20)
|
|
|
|
{
|
|
|
|
t[0]++;
|
2020-10-21 19:46:39 +00:00
|
|
|
|
|
|
|
actor->s.picnum++;
|
|
|
|
|
|
|
|
if (actor->s.picnum == fountain + 3)
|
|
|
|
actor->s.picnum = fountain + 1;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 19:46:39 +00:00
|
|
|
findplayer(actor, &x);
|
2020-05-07 07:49:05 +00:00
|
|
|
|
|
|
|
if (x > 512)
|
|
|
|
{
|
|
|
|
t[0] = 0;
|
2020-10-21 19:46:39 +00:00
|
|
|
actor->s.picnum = fountain;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
else t[0] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 19:46:39 +00:00
|
|
|
void moveflammable(DDukeActor* actor, int tire, int box, int pool)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 19:46:39 +00:00
|
|
|
auto spri = &actor->s;
|
2020-05-07 07:49:05 +00:00
|
|
|
int j;
|
2020-10-24 20:18:05 +00:00
|
|
|
if (actor->temp_data[0] == 1)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 20:18:05 +00:00
|
|
|
actor->temp_data[1]++;
|
|
|
|
if ((actor->temp_data[1] & 3) > 0) return;
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-24 20:18:05 +00:00
|
|
|
if (!isRR() && spri->picnum == tire && actor->temp_data[1] == 32)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 20:18:05 +00:00
|
|
|
spri->cstat = 0;
|
2020-10-21 19:46:39 +00:00
|
|
|
auto spawned = spawn(actor, pool);
|
|
|
|
spawned->s.shade = 127;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-24 20:18:05 +00:00
|
|
|
if (spri->shade < 64) spri->shade++;
|
2020-05-07 07:49:05 +00:00
|
|
|
else
|
|
|
|
{
|
2020-10-21 19:46:39 +00:00
|
|
|
deletesprite(actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-24 20:18:05 +00:00
|
|
|
j = spri->xrepeat - (krand() & 7);
|
2020-10-12 20:05:22 +00:00
|
|
|
if (j < 10)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 19:46:39 +00:00
|
|
|
deletesprite(actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-24 20:18:05 +00:00
|
|
|
spri->xrepeat = j;
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-24 20:18:05 +00:00
|
|
|
j = spri->yrepeat - (krand() & 7);
|
2020-10-12 20:05:22 +00:00
|
|
|
if (j < 4)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 19:46:39 +00:00
|
|
|
deletesprite(actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-10-24 20:18:05 +00:00
|
|
|
spri->yrepeat = j;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
2020-10-24 20:18:05 +00:00
|
|
|
if (box >= 0 && spri->picnum == box)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 19:46:39 +00:00
|
|
|
makeitfall(actor);
|
2020-10-24 20:18:05 +00:00
|
|
|
actor->ceilingz = sector[spri->sectnum].ceilingz;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 20:05:22 +00:00
|
|
|
|
2020-05-07 07:49:05 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 19:57:18 +00:00
|
|
|
void detonate(DDukeActor *actor, int explosion)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 19:57:18 +00:00
|
|
|
auto spri = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-07 07:49:05 +00:00
|
|
|
earthquaketime = 16;
|
|
|
|
|
2020-10-21 19:57:18 +00:00
|
|
|
DukeStatIterator itj(STAT_EFFECTOR);
|
|
|
|
while (auto effector = itj.Next())
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 19:57:18 +00:00
|
|
|
auto sj = &effector->s;
|
|
|
|
if (actor->s.hitag == sj->hitag)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-12 20:05:22 +00:00
|
|
|
if (sj->lotag == SE_13_EXPLOSIVE)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 20:23:12 +00:00
|
|
|
if (effector->temp_data[2] == 0)
|
|
|
|
effector->temp_data[2] = 1;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
2020-10-12 20:05:22 +00:00
|
|
|
else if (sj->lotag == SE_8_UP_OPEN_DOOR_LIGHTS)
|
2020-10-24 20:23:12 +00:00
|
|
|
effector->temp_data[4] = 1;
|
2020-10-12 20:05:22 +00:00
|
|
|
else if (sj->lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 20:23:12 +00:00
|
|
|
if (effector->temp_data[0] == 0)
|
|
|
|
effector->temp_data[0] = 1;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
2020-10-12 20:05:22 +00:00
|
|
|
else if (sj->lotag == SE_21_DROP_FLOOR)
|
2020-10-24 20:23:12 +00:00
|
|
|
effector->temp_data[0] = 1;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 20:23:12 +00:00
|
|
|
spri->z -= (32 << 8);
|
2020-05-07 20:30:19 +00:00
|
|
|
|
2020-10-24 20:23:12 +00:00
|
|
|
if ((t[3] == 1 && spri->xrepeat) || spri->lotag == -99)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2020-10-24 20:23:12 +00:00
|
|
|
int x = spri->extra;
|
2020-10-21 19:57:18 +00:00
|
|
|
spawn(actor, explosion);
|
2020-11-29 12:54:58 +00:00
|
|
|
fi.hitradius(actor, gs.seenineblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x);
|
2020-10-21 19:57:18 +00:00
|
|
|
S_PlayActorSound(PIPEBOMB_EXPLODE, actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
2020-05-07 20:30:19 +00:00
|
|
|
|
2020-10-24 20:23:12 +00:00
|
|
|
if (spri->xrepeat)
|
2020-10-21 19:57:18 +00:00
|
|
|
for (int x = 0; x < 8; x++) RANDOMSCRAP(actor);
|
2020-05-07 20:30:19 +00:00
|
|
|
|
2020-10-21 19:57:18 +00:00
|
|
|
deletesprite(actor);
|
2020-05-07 20:30:19 +00:00
|
|
|
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 19:57:18 +00:00
|
|
|
void movemasterswitch(DDukeActor *actor, int spectype1, int spectype2)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 19:57:18 +00:00
|
|
|
auto spri = &actor->s;
|
2020-10-24 20:23:12 +00:00
|
|
|
if (spri->yvel == 1)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-24 20:23:12 +00:00
|
|
|
spri->hitag--;
|
|
|
|
if (spri->hitag <= 0)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 19:57:18 +00:00
|
|
|
operatesectors(spri->sectnum, actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-21 19:57:18 +00:00
|
|
|
DukeSectIterator it(spri->sectnum);
|
|
|
|
while (auto effector = it.Next())
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 19:57:18 +00:00
|
|
|
auto sj = &effector->s;
|
|
|
|
if (sj->statnum == STAT_EFFECTOR)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-14 17:24:24 +00:00
|
|
|
switch (sj->lotag)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
|
|
|
case SE_2_EARTHQUAKE:
|
|
|
|
case SE_21_DROP_FLOOR:
|
|
|
|
case SE_31_FLOOR_RISE_FALL:
|
|
|
|
case SE_32_CEILING_RISE_FALL:
|
|
|
|
case SE_36_PROJ_SHOOTER:
|
2020-10-21 19:57:18 +00:00
|
|
|
effector->temp_data[0] = 1;
|
2020-05-07 07:49:05 +00:00
|
|
|
break;
|
|
|
|
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
|
2020-10-21 19:57:18 +00:00
|
|
|
effector->temp_data[4] = 1;
|
2020-05-07 07:49:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-10-14 17:24:24 +00:00
|
|
|
else if (sj->statnum == 6)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-14 17:24:24 +00:00
|
|
|
if (sj->picnum == spectype1 || sj->picnum == spectype2) // SEENINE and OOZFILTER
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-14 17:24:24 +00:00
|
|
|
sj->shade = -31;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-21 19:57:18 +00:00
|
|
|
deletesprite(actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:17:25 +00:00
|
|
|
void movetrash(DDukeActor *actor)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 20:17:25 +00:00
|
|
|
auto s = &actor->s;
|
2020-05-07 07:49:05 +00:00
|
|
|
if (s->xvel == 0) s->xvel = 1;
|
2020-10-21 20:17:25 +00:00
|
|
|
if (ssp(actor, CLIPMASK0))
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 20:17:25 +00:00
|
|
|
makeitfall(actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
if (krand() & 1) s->zvel -= 256;
|
2020-05-13 22:04:14 +00:00
|
|
|
if (abs(s->xvel) < 48)
|
2020-05-07 07:49:05 +00:00
|
|
|
s->xvel += (krand() & 3);
|
|
|
|
}
|
2020-10-21 20:17:25 +00:00
|
|
|
else deletesprite(actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:17:25 +00:00
|
|
|
void movewaterdrip(DDukeActor *actor, int drip)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 20:17:25 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-07 07:49:05 +00:00
|
|
|
int sect = s->sectnum;
|
|
|
|
|
|
|
|
if (t[1])
|
|
|
|
{
|
|
|
|
t[1]--;
|
|
|
|
if (t[1] == 0)
|
|
|
|
s->cstat &= 32767;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 20:17:25 +00:00
|
|
|
makeitfall(actor);
|
|
|
|
ssp(actor, CLIPMASK0);
|
2020-05-07 07:49:05 +00:00
|
|
|
if (s->xvel > 0) s->xvel -= 2;
|
|
|
|
|
|
|
|
if (s->zvel == 0)
|
|
|
|
{
|
|
|
|
s->cstat |= 32768;
|
|
|
|
|
|
|
|
if (s->pal != 2 && (isRR() || s->hitag == 0))
|
2020-10-21 20:17:25 +00:00
|
|
|
S_PlayActorSound(SOMETHING_DRIPPING, actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-21 20:17:25 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
|
|
|
if (!Owner || Owner->s.picnum != drip)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 20:17:25 +00:00
|
|
|
deletesprite(actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-05 19:20:55 +00:00
|
|
|
s->z = t[0];
|
|
|
|
s->backupz();
|
2020-05-07 07:49:05 +00:00
|
|
|
t[1] = 48 + (krand() & 31);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:17:25 +00:00
|
|
|
void movedoorshock(DDukeActor* actor)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 20:17:25 +00:00
|
|
|
auto s = &actor->s;
|
2020-05-07 07:49:05 +00:00
|
|
|
int sect = s->sectnum;
|
|
|
|
int j = abs(sector[sect].ceilingz - sector[sect].floorz) >> 9;
|
|
|
|
s->yrepeat = j + 4;
|
|
|
|
s->xrepeat = 16;
|
|
|
|
s->z = sector[sect].floorz;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:22:12 +00:00
|
|
|
void movetouchplate(DDukeActor* actor, int plate)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-07 07:49:05 +00:00
|
|
|
int sect = s->sectnum;
|
|
|
|
int x;
|
|
|
|
int p;
|
|
|
|
|
|
|
|
if (t[1] == 1 && s->hitag >= 0) //Move the sector floor
|
|
|
|
{
|
|
|
|
x = sector[sect].floorz;
|
|
|
|
|
|
|
|
if (t[3] == 1)
|
|
|
|
{
|
|
|
|
if (x >= t[2])
|
|
|
|
{
|
|
|
|
sector[sect].floorz = x;
|
|
|
|
t[1] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sector[sect].floorz += sector[sect].extra;
|
|
|
|
p = checkcursectnums(sect);
|
|
|
|
if (p >= 0) ps[p].posz += sector[sect].extra;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (x <= s->z)
|
|
|
|
{
|
|
|
|
sector[sect].floorz = s->z;
|
|
|
|
t[1] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sector[sect].floorz -= sector[sect].extra;
|
|
|
|
p = checkcursectnums(sect);
|
|
|
|
if (p >= 0)
|
|
|
|
ps[p].posz -= sector[sect].extra;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[5] == 1) return;
|
|
|
|
|
|
|
|
p = checkcursectnums(sect);
|
|
|
|
if (p >= 0 && (ps[p].on_ground || s->ang == 512))
|
|
|
|
{
|
|
|
|
if (t[0] == 0 && !check_activator_motion(s->lotag))
|
|
|
|
{
|
|
|
|
t[0] = 1;
|
|
|
|
t[1] = 1;
|
|
|
|
t[3] = !t[3];
|
|
|
|
operatemasterswitches(s->lotag);
|
|
|
|
operateactivators(s->lotag, p);
|
|
|
|
if (s->hitag > 0)
|
|
|
|
{
|
|
|
|
s->hitag--;
|
|
|
|
if (s->hitag == 0) t[5] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else t[0] = 0;
|
|
|
|
|
|
|
|
if (t[1] == 1)
|
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
DukeStatIterator it(STAT_STANDABLE);
|
|
|
|
while (auto act2 = it.Next())
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
if (act2 != actor && act2->s.picnum == plate && act2->s.lotag == s->lotag)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
act2->temp_data[1] = 1;
|
|
|
|
act2->temp_data[3] = t[3];
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:22:12 +00:00
|
|
|
void moveooz(DDukeActor* actor, int seenine, int seeninedead, int ooz, int explosion)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-07 20:30:19 +00:00
|
|
|
int j;
|
|
|
|
if (s->shade != -32 && s->shade != -33)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if (s->xrepeat)
|
2020-10-21 20:22:12 +00:00
|
|
|
j = (fi.ifhitbyweapon(actor) >= 0);
|
2020-05-07 20:30:19 +00:00
|
|
|
else
|
|
|
|
j = 0;
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
if (j || s->shade == -31)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if (j) s->lotag = 0;
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
t[3] = 1;
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-21 20:22:12 +00:00
|
|
|
DukeStatIterator it(STAT_STANDABLE);
|
|
|
|
while (auto act2 = it.Next())
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
auto ss = &act2->s;
|
2020-10-14 16:55:50 +00:00
|
|
|
if (s->hitag == ss->hitag && (ss->picnum == seenine || ss->picnum == ooz))
|
|
|
|
ss->shade = -32;
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (s->shade == -32)
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if (s->lotag > 0)
|
|
|
|
{
|
|
|
|
s->lotag -= 3;
|
|
|
|
if (s->lotag <= 0) s->lotag = -99;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
s->shade = -33;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
2020-05-07 20:30:19 +00:00
|
|
|
else
|
2020-05-07 07:49:05 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if (s->xrepeat > 0)
|
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
actor->temp_data[2]++;
|
|
|
|
if (actor->temp_data[2] == 3)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
|
|
|
if (s->picnum == ooz)
|
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
actor->temp_data[2] = 0;
|
|
|
|
detonate(actor, explosion);
|
2020-05-07 20:30:19 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (s->picnum != (seeninedead + 1))
|
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
actor->temp_data[2] = 0;
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
if (s->picnum == seeninedead) s->picnum++;
|
|
|
|
else if (s->picnum == seenine)
|
|
|
|
s->picnum = seeninedead;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
detonate(actor, explosion);
|
2020-05-07 20:30:19 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2020-10-21 20:22:12 +00:00
|
|
|
detonate(actor, explosion);
|
2020-05-07 20:30:19 +00:00
|
|
|
return;
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-21 20:22:12 +00:00
|
|
|
void movecanwithsomething(DDukeActor* actor)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
makeitfall(actor);
|
|
|
|
int j = fi.ifhitbyweapon(actor);
|
2020-05-07 20:30:19 +00:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
2020-10-21 20:22:12 +00:00
|
|
|
S_PlayActorSound(VENT_BUST, actor);
|
2020-05-07 20:30:19 +00:00
|
|
|
for (j = 0; j < 10; j++)
|
2020-10-21 20:22:12 +00:00
|
|
|
RANDOMSCRAP(actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
|
2020-10-21 20:22:12 +00:00
|
|
|
if (actor->s.lotag) spawn(actor, actor->s.lotag);
|
|
|
|
deletesprite(actor);
|
2020-05-07 07:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 12:38:01 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:29:35 +00:00
|
|
|
void bounce(DDukeActor* actor)
|
2020-05-07 12:38:01 +00:00
|
|
|
{
|
2020-10-21 20:29:35 +00:00
|
|
|
auto s = &actor->s;
|
2021-01-04 11:36:54 +00:00
|
|
|
int xvect = MulScale(s->xvel, bcos(s->ang), 10);
|
|
|
|
int yvect = MulScale(s->xvel, bsin(s->ang), 10);
|
2020-10-21 20:29:35 +00:00
|
|
|
int zvect = s->zvel;
|
2020-05-07 12:38:01 +00:00
|
|
|
|
2020-10-21 20:29:35 +00:00
|
|
|
int hitsect = s->sectnum;
|
2020-05-07 12:38:01 +00:00
|
|
|
|
2020-10-21 20:29:35 +00:00
|
|
|
int k = sector[hitsect].wallptr;
|
|
|
|
int l = wall[k].point2;
|
|
|
|
int daang = getangle(wall[l].x - wall[k].x, wall[l].y - wall[k].y);
|
2020-05-07 12:38:01 +00:00
|
|
|
|
2020-10-21 20:29:35 +00:00
|
|
|
if (s->z < (actor->floorz + actor->ceilingz) >> 1)
|
2020-05-07 12:38:01 +00:00
|
|
|
k = sector[hitsect].ceilingheinum;
|
|
|
|
else
|
|
|
|
k = sector[hitsect].floorheinum;
|
|
|
|
|
2021-01-04 11:36:54 +00:00
|
|
|
int dax = MulScale(k, bsin(daang), 14);
|
|
|
|
int day = MulScale(k, -bcos(daang), 14);
|
2020-10-21 20:29:35 +00:00
|
|
|
int daz = 4096;
|
2020-05-07 12:38:01 +00:00
|
|
|
|
|
|
|
k = xvect * dax + yvect * day + zvect * daz;
|
|
|
|
l = dax * dax + day * day + daz * daz;
|
|
|
|
if ((abs(k) >> 14) < l)
|
|
|
|
{
|
2021-01-04 11:51:41 +00:00
|
|
|
k = DivScale(k, l, 17);
|
2021-01-04 11:36:54 +00:00
|
|
|
xvect -= MulScale(dax, k, 16);
|
|
|
|
yvect -= MulScale(day, k, 16);
|
|
|
|
zvect -= MulScale(daz, k, 16);
|
2020-05-07 12:38:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
s->zvel = zvect;
|
2021-01-04 10:40:08 +00:00
|
|
|
s->xvel = ksqrt(DMulScale(xvect, xvect, yvect, yvect, 8));
|
2020-05-07 12:38:01 +00:00
|
|
|
s->ang = getangle(xvect, yvect);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2020-05-07 20:30:19 +00:00
|
|
|
// taken out of moveweapon
|
2020-05-07 12:38:01 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:29:35 +00:00
|
|
|
void movetongue(DDukeActor *actor, int tongue, int jaw)
|
2020-05-07 12:38:01 +00:00
|
|
|
{
|
2020-10-21 20:29:35 +00:00
|
|
|
auto s = &actor->s;
|
2020-11-14 09:49:46 +00:00
|
|
|
actor->temp_data[0] = bsin(actor->temp_data[1], -9);
|
2020-10-21 20:29:35 +00:00
|
|
|
actor->temp_data[1] += 32;
|
|
|
|
if (actor->temp_data[1] > 2047)
|
2020-05-07 12:38:01 +00:00
|
|
|
{
|
2020-10-21 20:29:35 +00:00
|
|
|
deletesprite(actor);
|
2020-05-07 12:38:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-21 20:29:35 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
|
|
|
if (!Owner) return;
|
|
|
|
|
|
|
|
if (Owner->s.statnum == MAXSTATUS)
|
|
|
|
if (badguy(Owner) == 0)
|
2020-05-07 12:38:01 +00:00
|
|
|
{
|
2020-10-21 20:29:35 +00:00
|
|
|
deletesprite(actor);
|
2020-05-07 12:38:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-21 20:29:35 +00:00
|
|
|
s->ang = Owner->s.ang;
|
|
|
|
s->x = Owner->s.x;
|
|
|
|
s->y = Owner->s.y;
|
|
|
|
if (Owner->s.picnum == TILE_APLAYER)
|
|
|
|
s->z = Owner->s.z - (34 << 8);
|
|
|
|
for (int k = 0; k < actor->temp_data[0]; k++)
|
2020-05-07 12:38:01 +00:00
|
|
|
{
|
2020-10-21 20:29:35 +00:00
|
|
|
auto q = EGS(s->sectnum,
|
2021-01-04 11:36:54 +00:00
|
|
|
s->x + MulScale(k, bcos(s->ang), 9),
|
|
|
|
s->y + MulScale(k, bsin(s->ang), 9),
|
2021-01-04 12:35:33 +00:00
|
|
|
s->z + ((k * Sgn(s->zvel)) * abs(s->zvel / 12)), tongue, -40 + (k << 1),
|
2020-10-21 20:29:35 +00:00
|
|
|
8, 8, 0, 0, 0, actor, 5);
|
|
|
|
if (q)
|
|
|
|
{
|
|
|
|
q->s.cstat = 128;
|
|
|
|
q->s.pal = 8;
|
|
|
|
}
|
2020-05-07 12:38:01 +00:00
|
|
|
}
|
2020-10-21 20:29:35 +00:00
|
|
|
int k = actor->temp_data[0]; // do not depend on the above loop counter.
|
|
|
|
auto spawned = EGS(s->sectnum,
|
2021-01-04 11:36:54 +00:00
|
|
|
s->x + MulScale(k, bcos(s->ang), 9),
|
|
|
|
s->y + MulScale(k, bsin(s->ang), 9),
|
2021-01-04 12:35:33 +00:00
|
|
|
s->z + ((k * Sgn(s->zvel)) * abs(s->zvel / 12)), jaw, -40,
|
2020-10-21 20:29:35 +00:00
|
|
|
32, 32, 0, 0, 0, actor, 5);
|
|
|
|
if (spawned)
|
|
|
|
{
|
|
|
|
spawned->s.cstat = 128;
|
|
|
|
if (actor->temp_data[1] > 512 && actor->temp_data[1] < (1024))
|
|
|
|
spawned->s.picnum = jaw + 1;
|
|
|
|
}
|
2020-05-07 12:38:01 +00:00
|
|
|
}
|
|
|
|
|
2020-05-08 22:34:48 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2020-10-18 08:42:26 +00:00
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:29:35 +00:00
|
|
|
void rpgexplode(DDukeActor *actor, int hit, const vec3_t &pos, int EXPLOSION2, int EXPLOSION2BOT, int newextra, int playsound)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-21 20:29:35 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
auto explosion = spawn(actor, EXPLOSION2);
|
|
|
|
explosion->s.pos = pos;
|
2020-10-18 08:42:26 +00:00
|
|
|
|
|
|
|
if (s->xrepeat < 10)
|
|
|
|
{
|
2020-10-21 20:29:35 +00:00
|
|
|
explosion->s.xrepeat = 6;
|
|
|
|
explosion->s.yrepeat = 6;
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
2020-10-22 19:19:24 +00:00
|
|
|
else if (hit == kHitSector)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-24 17:44:10 +00:00
|
|
|
if (s->zvel > 0 && EXPLOSION2BOT >= 0)
|
2020-10-21 20:29:35 +00:00
|
|
|
spawn(actor, EXPLOSION2BOT);
|
2020-10-24 17:44:10 +00:00
|
|
|
else
|
|
|
|
{
|
2020-10-21 20:29:35 +00:00
|
|
|
explosion->s.cstat |= 8;
|
|
|
|
explosion->s.z += (48 << 8);
|
2020-10-24 17:44:10 +00:00
|
|
|
}
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
|
|
|
if (newextra > 0) s->extra = newextra;
|
2020-10-21 20:29:35 +00:00
|
|
|
S_PlayActorSound(playsound, actor);
|
2020-10-18 08:42:26 +00:00
|
|
|
|
|
|
|
if (s->xrepeat >= 10)
|
|
|
|
{
|
|
|
|
int x = s->extra;
|
2020-11-29 12:54:58 +00:00
|
|
|
fi.hitradius(actor, gs.rpgblastradius, x >> 2, x >> 1, x - (x >> 2), x);
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int x = s->extra + (global_random & 3);
|
2020-11-29 12:54:58 +00:00
|
|
|
fi.hitradius(actor, (gs.rpgblastradius >> 1), x >> 2, x >> 1, x - (x >> 2), x);
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2020-05-08 22:34:48 +00:00
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:34:45 +00:00
|
|
|
bool respawnmarker(DDukeActor *actor, int yellow, int green)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
actor->temp_data[0]++;
|
2020-11-29 12:54:58 +00:00
|
|
|
if (actor->temp_data[0] > gs.respawnitemtime)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return false;
|
|
|
|
}
|
2020-11-29 12:54:58 +00:00
|
|
|
if (actor->temp_data[0] >= (gs.respawnitemtime >> 1) && actor->temp_data[0] < ((gs.respawnitemtime >> 1) + (gs.respawnitemtime >> 2)))
|
2020-10-21 20:34:45 +00:00
|
|
|
actor->s.picnum = yellow;
|
2020-11-29 12:54:58 +00:00
|
|
|
else if (actor->temp_data[0] > ((gs.respawnitemtime >> 1) + (gs.respawnitemtime >> 2)))
|
2020-10-21 20:34:45 +00:00
|
|
|
actor->s.picnum = green;
|
|
|
|
makeitfall(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:34:45 +00:00
|
|
|
bool rat(DDukeActor* actor, bool makesound)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
makeitfall(actor);
|
|
|
|
if (ssp(actor, CLIPMASK0))
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
if (makesound && (krand() & 255) == 0) S_PlayActorSound(RATTY, actor);
|
2020-11-14 09:49:46 +00:00
|
|
|
s->ang += (krand() & 31) - 15 + bsin(actor->temp_data[0] << 8, -11);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
actor->temp_data[0]++;
|
|
|
|
if (actor->temp_data[0] > 1)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else s->ang = (krand() & 2047);
|
|
|
|
}
|
|
|
|
if (s->xvel < 128)
|
|
|
|
s->xvel += 2;
|
|
|
|
s->ang += (krand() & 3) - 6;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-06 19:11:36 +00:00
|
|
|
|
2020-10-21 20:34:45 +00:00
|
|
|
bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
auto s = &actor->s;
|
2020-05-08 22:34:48 +00:00
|
|
|
if (s->xvel)
|
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
DukeStatIterator it(STAT_DEFAULT);
|
|
|
|
while (auto aa = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
if (aa->s.picnum == pocket && ldist(aa, actor) < 52)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-21 20:43:23 +00:00
|
|
|
Collision coll;
|
|
|
|
int j = clipmove_ex(&s->x, &s->y, &s->z, &s->sectnum,
|
2021-01-04 11:36:54 +00:00
|
|
|
(MulScale(s->xvel, bcos(s->ang), 14) * TICSPERFRAME) << 11,
|
|
|
|
(MulScale(s->xvel, bsin(s->ang), 14) * TICSPERFRAME) << 11,
|
2020-10-21 20:43:23 +00:00
|
|
|
24L, (4 << 8), (4 << 8), CLIPMASK1, coll);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-10-21 20:43:23 +00:00
|
|
|
if (j == kHitWall)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:43:23 +00:00
|
|
|
j = coll.index;
|
2020-05-08 22:34:48 +00:00
|
|
|
int k = getangle(
|
|
|
|
wall[wall[j].point2].x - wall[j].x,
|
|
|
|
wall[wall[j].point2].y - wall[j].y);
|
|
|
|
s->ang = ((k << 1) - s->ang) & 2047;
|
|
|
|
}
|
2020-10-21 20:43:23 +00:00
|
|
|
else if (j == kHitSprite)
|
2020-10-24 04:33:31 +00:00
|
|
|
{
|
2020-10-24 05:15:10 +00:00
|
|
|
fi.checkhitsprite(actor, coll.actor);
|
2020-10-24 04:33:31 +00:00
|
|
|
}
|
2020-10-21 20:43:23 +00:00
|
|
|
|
2020-05-08 22:34:48 +00:00
|
|
|
s->xvel--;
|
|
|
|
if (s->xvel < 0) s->xvel = 0;
|
|
|
|
if (s->picnum == stripeball)
|
|
|
|
{
|
|
|
|
s->cstat = 257;
|
|
|
|
s->cstat |= 4 & s->xvel;
|
|
|
|
s->cstat |= 8 & s->xvel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int x;
|
2020-10-21 20:43:23 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
if (x < 1596)
|
|
|
|
{
|
2020-05-12 11:43:24 +00:00
|
|
|
// if(s->pal == 12)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-14 16:55:50 +00:00
|
|
|
int j = getincangle(ps[p].angle.ang.asbuild(), getangle(s->x - ps[p].posx, s->y - ps[p].posy));
|
2020-08-28 20:51:05 +00:00
|
|
|
if (j > -64 && j < 64 && PlayerInput(p, SB_OPEN))
|
2020-05-08 22:34:48 +00:00
|
|
|
if (ps[p].toggle_key_flag == 1)
|
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
DukeStatIterator it(STAT_ACTOR);
|
|
|
|
DDukeActor *act2;
|
|
|
|
while ((act2 = it.Next()))
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:34:45 +00:00
|
|
|
auto sa = &act2->s;
|
2020-10-14 16:55:50 +00:00
|
|
|
if (sa->picnum == queball || sa->picnum == stripeball)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-14 16:55:50 +00:00
|
|
|
j = getincangle(ps[p].angle.ang.asbuild(), getangle(sa->x - ps[p].posx, sa->y - ps[p].posy));
|
2020-05-08 22:34:48 +00:00
|
|
|
if (j > -64 && j < 64)
|
|
|
|
{
|
|
|
|
int l;
|
2020-10-23 15:44:45 +00:00
|
|
|
findplayer(act2, &l);
|
2020-05-08 22:34:48 +00:00
|
|
|
if (x > l) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-21 20:34:45 +00:00
|
|
|
if (act2 == nullptr)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
|
|
|
if (s->pal == 12)
|
|
|
|
s->xvel = 164;
|
|
|
|
else s->xvel = 140;
|
2020-10-07 12:13:21 +00:00
|
|
|
s->ang = ps[p].angle.ang.asbuild();
|
2020-05-08 22:34:48 +00:00
|
|
|
ps[p].toggle_key_flag = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (x < 512 && s->sectnum == ps[p].cursectnum)
|
|
|
|
{
|
|
|
|
s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy);
|
|
|
|
s->xvel = 48;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:59:56 +00:00
|
|
|
void forcesphere(DDukeActor* actor, int forcesphere)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-08 22:34:48 +00:00
|
|
|
int sect = s->sectnum;
|
|
|
|
if (s->yvel == 0)
|
|
|
|
{
|
|
|
|
s->yvel = 1;
|
|
|
|
|
|
|
|
for (int l = 512; l < (2048 - 512); l += 128)
|
|
|
|
for (int j = 0; j < 2048; j += 128)
|
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
auto k = spawn(actor, forcesphere);
|
2020-10-24 07:05:54 +00:00
|
|
|
k->s.cstat = 257 + 128;
|
|
|
|
k->s.clipdist = 64;
|
|
|
|
k->s.ang = j;
|
2020-11-14 09:49:46 +00:00
|
|
|
k->s.zvel = bsin(l, -5);
|
|
|
|
k->s.xvel = bcos(l, -9);
|
2020-10-21 20:59:56 +00:00
|
|
|
k->SetOwner(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[3] > 0)
|
|
|
|
{
|
|
|
|
if (s->zvel < 6144)
|
|
|
|
s->zvel += 192;
|
|
|
|
s->z += s->zvel;
|
|
|
|
if (s->z > sector[sect].floorz)
|
|
|
|
s->z = sector[sect].floorz;
|
|
|
|
t[3]--;
|
|
|
|
if (t[3] == 0)
|
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (t[2] > 10)
|
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
DukeStatIterator it(STAT_MISC);
|
|
|
|
while (auto aa = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
if (aa->GetOwner() == actor && aa->s.picnum == forcesphere)
|
|
|
|
aa->temp_data[1] = 1 + (krand() & 63);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
t[3] = 64;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:59:56 +00:00
|
|
|
void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int painsnd, int roamsnd, int shift, int (*getspawn)(DDukeActor* i))
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-08 22:34:48 +00:00
|
|
|
int sect = s->sectnum;
|
2020-10-21 20:59:56 +00:00
|
|
|
int a;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-10-21 20:59:56 +00:00
|
|
|
getglobalz(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
if (sector[s->sectnum].ceilingstat & 1)
|
|
|
|
s->shade += (sector[s->sectnum].ceilingshade - s->shade) >> 1;
|
|
|
|
else s->shade += (sector[s->sectnum].floorshade - s->shade) >> 1;
|
|
|
|
|
|
|
|
if (s->z < sector[sect].ceilingz + (32 << 8))
|
|
|
|
s->z = sector[sect].ceilingz + (32 << 8);
|
|
|
|
|
|
|
|
if (ud.multimode < 2)
|
|
|
|
{
|
|
|
|
if (actor_tog == 1)
|
|
|
|
{
|
|
|
|
s->cstat = (short)32768;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (actor_tog == 2) s->cstat = 257;
|
|
|
|
}
|
2020-10-21 20:59:56 +00:00
|
|
|
if (fi.ifhitbyweapon(actor) >= 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
|
|
|
if (s->extra < 0 && t[0] != -1)
|
|
|
|
{
|
|
|
|
t[0] = -1;
|
|
|
|
s->extra = 0;
|
|
|
|
}
|
2020-10-21 20:59:56 +00:00
|
|
|
if (painsnd >= 0) S_PlayActorSound(painsnd, actor);
|
|
|
|
RANDOMSCRAP(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (t[0] == -1)
|
|
|
|
{
|
|
|
|
s->z += 1024;
|
|
|
|
t[2]++;
|
2020-10-21 20:59:56 +00:00
|
|
|
if ((t[2] & 3) == 0) spawn(actor, explosion);
|
|
|
|
getglobalz(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
s->ang += 96;
|
|
|
|
s->xvel = 128;
|
2020-10-21 20:59:56 +00:00
|
|
|
int j = ssp(actor, CLIPMASK0);
|
|
|
|
if (j != 1 || s->z > actor->floorz)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
|
|
|
for (int l = 0; l < 16; l++)
|
2020-10-21 20:59:56 +00:00
|
|
|
RANDOMSCRAP(actor);
|
|
|
|
S_PlayActorSound(LASERTRIP_EXPLODE, actor);
|
|
|
|
int sp = getspawn(actor);
|
|
|
|
if (sp >= 0) spawn(actor, sp);
|
2020-05-08 22:34:48 +00:00
|
|
|
ps[myconnectindex].actors_killed++;
|
2020-10-21 20:59:56 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
if (s->z > actor->floorz - (48 << 8))
|
|
|
|
s->z = actor->floorz - (48 << 8);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int x;
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-10-21 20:59:56 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
// 3 = findplayerz, 4 = shoot
|
|
|
|
|
|
|
|
if (t[0] >= 4)
|
|
|
|
{
|
|
|
|
t[2]++;
|
|
|
|
if ((t[2] & 15) == 0)
|
|
|
|
{
|
|
|
|
a = s->ang;
|
2020-10-21 20:59:56 +00:00
|
|
|
s->ang = actor->tempang;
|
|
|
|
if (attacksnd >= 0) S_PlayActorSound(attacksnd, actor);
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(actor, firelaser);
|
2020-05-08 22:34:48 +00:00
|
|
|
s->ang = a;
|
|
|
|
}
|
|
|
|
if (t[2] > (26 * 3) || !cansee(s->x, s->y, s->z - (16 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
|
|
|
|
{
|
|
|
|
t[0] = 0;
|
|
|
|
t[2] = 0;
|
|
|
|
}
|
2020-10-21 20:59:56 +00:00
|
|
|
else actor->tempang +=
|
|
|
|
getincangle(actor->tempang, getangle(ps[p].posx - s->x, ps[p].posy - s->y)) / 3;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else if (t[0] == 2 || t[0] == 3)
|
|
|
|
{
|
|
|
|
t[3] = 0;
|
|
|
|
if (s->xvel > 0) s->xvel -= 16;
|
|
|
|
else s->xvel = 0;
|
|
|
|
|
|
|
|
if (t[0] == 2)
|
|
|
|
{
|
|
|
|
int l = ps[p].posz - s->z;
|
|
|
|
if (abs(l) < (48 << 8)) t[0] = 3;
|
2021-01-04 12:35:33 +00:00
|
|
|
else s->z += Sgn(ps[p].posz - s->z) << shift; // The shift here differs between Duke and RR.
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t[2]++;
|
|
|
|
if (t[2] > (26 * 3) || !cansee(s->x, s->y, s->z - (16 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
|
|
|
|
{
|
|
|
|
t[0] = 1;
|
|
|
|
t[2] = 0;
|
|
|
|
}
|
|
|
|
else if ((t[2] & 15) == 0 && attacksnd >= 0)
|
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
S_PlayActorSound(attacksnd, actor);
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(actor, firelaser);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
s->ang += getincangle(s->ang, getangle(ps[p].posx - s->x, ps[p].posy - s->y)) >> 2;
|
|
|
|
}
|
|
|
|
|
2020-10-21 20:59:56 +00:00
|
|
|
if (t[0] != 2 && t[0] != 3 && Owner)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
int l = ldist(Owner, actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
if (l <= 1524)
|
|
|
|
{
|
|
|
|
a = s->ang;
|
|
|
|
s->xvel >>= 1;
|
|
|
|
}
|
2020-10-21 20:59:56 +00:00
|
|
|
else a = getangle(Owner->s.x - s->x, Owner->s.y - s->y);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
if (t[0] == 1 || t[0] == 4) // Found a locator and going with it
|
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
l = dist(Owner, actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
if (l <= 1524) { if (t[0] == 1) t[0] = 0; else t[0] = 5; }
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Control speed here
|
|
|
|
if (l > 1524) { if (s->xvel < 256) s->xvel += 32; }
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (s->xvel > 0) s->xvel -= 16;
|
|
|
|
else s->xvel = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[0] < 2) t[2]++;
|
|
|
|
|
|
|
|
if (x < 6144 && t[0] < 2 && t[2] > (26 * 4))
|
|
|
|
{
|
|
|
|
t[0] = 2 + (krand() & 2);
|
|
|
|
t[2] = 0;
|
2020-10-21 20:59:56 +00:00
|
|
|
actor->tempang = s->ang;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[0] == 0 || t[0] == 5)
|
|
|
|
{
|
|
|
|
if (t[0] == 0)
|
|
|
|
t[0] = 1;
|
|
|
|
else t[0] = 4;
|
2020-10-21 20:59:56 +00:00
|
|
|
auto NewOwner = LocateTheLocator(s->hitag, -1);
|
|
|
|
if (!NewOwner)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
s->hitag = actor->temp_data[5];
|
|
|
|
NewOwner = LocateTheLocator(s->hitag, -1);
|
|
|
|
if (!NewOwner)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 20:59:56 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else s->hitag++;
|
2020-11-01 06:56:49 +00:00
|
|
|
actor->SetOwner(NewOwner);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
t[3] = getincangle(s->ang, a);
|
|
|
|
s->ang += t[3] >> 3;
|
|
|
|
|
2020-10-21 20:59:56 +00:00
|
|
|
if (s->z < Owner->s.z)
|
2020-05-08 22:34:48 +00:00
|
|
|
s->z += 1024;
|
|
|
|
else s->z -= 1024;
|
|
|
|
}
|
|
|
|
|
2020-10-21 21:39:12 +00:00
|
|
|
if (roamsnd >= 0 && S_CheckActorSoundPlaying(actor, roamsnd) < 1)
|
2020-10-21 20:59:56 +00:00
|
|
|
S_PlayActorSound(roamsnd, actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-10-21 20:59:56 +00:00
|
|
|
ssp(actor, CLIPMASK0);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:04:14 +00:00
|
|
|
void ooz(DDukeActor *actor)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 21:04:14 +00:00
|
|
|
getglobalz(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-10-21 21:04:14 +00:00
|
|
|
int j = (actor->floorz - actor->ceilingz) >> 9;
|
2020-05-08 22:34:48 +00:00
|
|
|
if (j > 255) j = 255;
|
|
|
|
|
|
|
|
int x = 25 - (j >> 1);
|
|
|
|
if (x < 8) x = 8;
|
|
|
|
else if (x > 48) x = 48;
|
|
|
|
|
2020-10-21 21:04:14 +00:00
|
|
|
actor->s.yrepeat = j;
|
|
|
|
actor->s.xrepeat = x;
|
|
|
|
actor->s.z = actor->floorz;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:04:14 +00:00
|
|
|
void reactor(DDukeActor* actor, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT, int REACTORSPARK, int REACTOR2SPARK)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 21:04:14 +00:00
|
|
|
spritetype* s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
int sect = actor->s.sectnum;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
if (t[4] == 1)
|
|
|
|
{
|
2020-10-21 21:04:14 +00:00
|
|
|
DukeSectIterator it(sect);
|
|
|
|
while (auto act2 = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 21:04:14 +00:00
|
|
|
auto sprj = &act2->s;
|
2020-10-13 22:30:14 +00:00
|
|
|
if (sprj->picnum == SECTOREFFECTOR)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-13 22:30:14 +00:00
|
|
|
if (sprj->lotag == 1)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-13 22:30:14 +00:00
|
|
|
sprj->lotag = (short)65535;
|
|
|
|
sprj->hitag = (short)65535;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-13 22:30:14 +00:00
|
|
|
else if (sprj->picnum == REACTOR)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-13 22:30:14 +00:00
|
|
|
sprj->picnum = REACTORBURNT;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-13 22:30:14 +00:00
|
|
|
else if (sprj->picnum == REACTOR2)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-13 22:30:14 +00:00
|
|
|
sprj->picnum = REACTOR2BURNT;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-13 22:30:14 +00:00
|
|
|
else if (sprj->picnum == REACTORSPARK || sprj->picnum == REACTOR2SPARK)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-13 22:30:14 +00:00
|
|
|
sprj->cstat = (short)32768;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-21 21:04:14 +00:00
|
|
|
}
|
|
|
|
return;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (t[1] >= 20)
|
|
|
|
{
|
|
|
|
t[4] = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int x;
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
t[2]++;
|
|
|
|
if (t[2] == 4) t[2] = 0;
|
|
|
|
|
|
|
|
if (x < 4096)
|
|
|
|
{
|
|
|
|
if ((krand() & 255) < 16)
|
|
|
|
{
|
|
|
|
if (!S_CheckSoundPlaying(DUKE_LONGTERM_PAIN))
|
2020-10-21 21:04:14 +00:00
|
|
|
S_PlayActorSound(DUKE_LONGTERM_PAIN, ps[p].GetActor());
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-10-21 21:04:14 +00:00
|
|
|
S_PlayActorSound(SHORT_CIRCUIT, actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-10-21 21:04:14 +00:00
|
|
|
ps[p].GetActor()->s.extra--;
|
2020-05-08 22:34:48 +00:00
|
|
|
SetPlayerPal(&ps[p], PalEntry(32, 32, 0, 0));
|
|
|
|
}
|
|
|
|
t[0] += 128;
|
|
|
|
if (t[3] == 0)
|
|
|
|
t[3] = 1;
|
|
|
|
}
|
|
|
|
else t[3] = 0;
|
|
|
|
|
|
|
|
if (t[1])
|
|
|
|
{
|
|
|
|
t[1]++;
|
|
|
|
|
|
|
|
t[4] = s->z;
|
|
|
|
s->z = sector[sect].floorz - (krand() % (sector[sect].floorz - sector[sect].ceilingz));
|
|
|
|
|
|
|
|
switch (t[1])
|
|
|
|
{
|
|
|
|
case 3:
|
2020-10-14 16:55:50 +00:00
|
|
|
{
|
2020-05-08 22:34:48 +00:00
|
|
|
//Turn on all of those flashing sectoreffector.
|
2020-10-21 21:04:14 +00:00
|
|
|
fi.hitradius(actor, 4096,
|
2020-11-29 14:09:23 +00:00
|
|
|
gs.impact_damage << 2,
|
|
|
|
gs.impact_damage << 2,
|
|
|
|
gs.impact_damage << 2,
|
|
|
|
gs.impact_damage << 2);
|
2020-10-21 21:04:14 +00:00
|
|
|
DukeStatIterator it(STAT_STANDABLE);
|
|
|
|
while (auto act2 = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 21:04:14 +00:00
|
|
|
auto sj = &act2->s;
|
2020-10-14 16:55:50 +00:00
|
|
|
if (sj->picnum == MASTERSWITCH)
|
|
|
|
if (sj->hitag == s->hitag)
|
|
|
|
if (sj->yvel == 0)
|
|
|
|
sj->yvel = 1;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2020-10-14 16:55:50 +00:00
|
|
|
}
|
2020-05-08 22:34:48 +00:00
|
|
|
case 4:
|
|
|
|
case 7:
|
|
|
|
case 10:
|
|
|
|
case 15:
|
2020-10-14 17:24:24 +00:00
|
|
|
{
|
2020-10-21 21:04:14 +00:00
|
|
|
DukeSectIterator it(sect);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 21:04:14 +00:00
|
|
|
if (a2 != actor)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 21:04:14 +00:00
|
|
|
deletesprite(a2);
|
2020-07-31 23:04:17 +00:00
|
|
|
break;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2020-10-14 17:24:24 +00:00
|
|
|
}
|
2020-05-08 22:34:48 +00:00
|
|
|
for (x = 0; x < 16; x++)
|
2020-10-21 21:04:14 +00:00
|
|
|
RANDOMSCRAP(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
s->z = t[4];
|
|
|
|
t[4] = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 21:04:14 +00:00
|
|
|
int j = fi.ifhitbyweapon(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
|
|
|
for (x = 0; x < 32; x++)
|
2020-10-21 21:04:14 +00:00
|
|
|
RANDOMSCRAP(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
if (s->extra < 0)
|
|
|
|
t[1] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:04:14 +00:00
|
|
|
void camera(DDukeActor *actor)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 21:04:14 +00:00
|
|
|
spritetype* s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-08 22:34:48 +00:00
|
|
|
if (t[0] == 0)
|
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
if (gs.camerashitable)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-21 21:04:14 +00:00
|
|
|
int j = fi.ifhitbyweapon(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
|
|
|
t[0] = 1; // static
|
|
|
|
s->cstat = (short)32768;
|
|
|
|
for (int x = 0; x < 5; x++)
|
2020-10-21 21:04:14 +00:00
|
|
|
RANDOMSCRAP(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-09-23 05:34:03 +00:00
|
|
|
|
2020-05-08 22:34:48 +00:00
|
|
|
if (s->hitag > 0)
|
|
|
|
{
|
2020-09-23 23:05:42 +00:00
|
|
|
// alias our temp_data array indexes.
|
|
|
|
auto& increment = t[1];
|
|
|
|
auto& minimum = t[2];
|
|
|
|
auto& maximum = t[3];
|
|
|
|
auto& setupflag = t[4];
|
|
|
|
|
2020-09-23 08:31:12 +00:00
|
|
|
// set up camera if already not.
|
2020-09-23 23:05:42 +00:00
|
|
|
if (setupflag != 1)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-09-23 23:05:42 +00:00
|
|
|
increment = 8;
|
|
|
|
minimum = s->ang - s->hitag - increment;
|
|
|
|
maximum = s->ang + s->hitag - increment;
|
|
|
|
setupflag = 1;
|
2020-09-23 08:31:12 +00:00
|
|
|
}
|
|
|
|
|
2020-09-23 23:05:42 +00:00
|
|
|
// update angle accordingly.
|
|
|
|
if (s->ang == minimum || s->ang == maximum)
|
2020-09-23 08:31:12 +00:00
|
|
|
{
|
2020-09-23 23:05:42 +00:00
|
|
|
increment = -increment;
|
|
|
|
s->ang += increment;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-09-23 23:05:42 +00:00
|
|
|
else if (s->ang + increment < minimum)
|
2020-09-23 08:31:12 +00:00
|
|
|
{
|
2020-09-23 23:05:42 +00:00
|
|
|
s->ang = minimum;
|
2020-09-23 08:31:12 +00:00
|
|
|
}
|
2020-09-23 23:05:42 +00:00
|
|
|
else if (s->ang + increment > maximum)
|
2020-09-23 08:31:12 +00:00
|
|
|
{
|
2020-09-23 23:05:42 +00:00
|
|
|
s->ang = maximum;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->ang += increment;
|
2020-09-23 08:31:12 +00:00
|
|
|
}
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-05 09:58:39 +00:00
|
|
|
|
2020-05-09 18:27:06 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// taken out of moveexplosion
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:11:06 +00:00
|
|
|
void forcesphereexplode(DDukeActor *actor)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-10-21 21:11:06 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
int l = actor->s.xrepeat;
|
2020-05-09 18:27:06 +00:00
|
|
|
if (t[1] > 0)
|
|
|
|
{
|
|
|
|
t[1]--;
|
|
|
|
if (t[1] == 0)
|
|
|
|
{
|
2020-10-21 21:11:06 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-10-21 21:11:06 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
|
|
|
if (!Owner) return;
|
|
|
|
if (Owner->temp_data[1] == 0)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
|
|
|
if (t[0] < 64)
|
|
|
|
{
|
|
|
|
t[0]++;
|
|
|
|
l += 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (t[0] > 64)
|
|
|
|
{
|
|
|
|
t[0]--;
|
|
|
|
l -= 3;
|
|
|
|
}
|
|
|
|
|
2020-10-21 21:11:06 +00:00
|
|
|
actor->s.x = Owner->s.x;
|
|
|
|
actor->s.y = Owner->s.y;
|
|
|
|
actor->s.z = Owner->s.z;
|
|
|
|
actor->s.ang += Owner->temp_data[0];
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
if (l > 64) l = 64;
|
|
|
|
else if (l < 1) l = 1;
|
|
|
|
|
2020-10-21 21:11:06 +00:00
|
|
|
actor->s.xrepeat = l;
|
|
|
|
actor->s.yrepeat = l;
|
|
|
|
actor->s.shade = (l >> 1) - 48;
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
for (int j = t[0]; j > 0; j--)
|
2020-10-21 21:11:06 +00:00
|
|
|
ssp(actor, CLIPMASK0);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:11:06 +00:00
|
|
|
void watersplash2(DDukeActor* actor)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-10-21 21:11:06 +00:00
|
|
|
int sect = actor->s.sectnum;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-09 18:27:06 +00:00
|
|
|
t[0]++;
|
|
|
|
if (t[0] == 1)
|
|
|
|
{
|
|
|
|
if (sector[sect].lotag != 1 && sector[sect].lotag != 2)
|
|
|
|
{
|
2020-10-21 21:11:06 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!S_CheckSoundPlaying(ITEM_SPLASH))
|
2020-10-21 21:11:06 +00:00
|
|
|
S_PlayActorSound(ITEM_SPLASH, actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
if (t[0] == 3)
|
|
|
|
{
|
|
|
|
t[0] = 0;
|
|
|
|
t[1]++;
|
|
|
|
}
|
|
|
|
if (t[1] == 5)
|
2020-10-21 21:11:06 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:11:06 +00:00
|
|
|
void frameeffect1(DDukeActor *actor)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-10-21 21:11:06 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
auto Owner = actor->GetOwner();
|
|
|
|
if (Owner)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
|
|
|
t[0]++;
|
|
|
|
|
|
|
|
if (t[0] > 7)
|
|
|
|
{
|
2020-10-21 21:11:06 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-10-21 21:11:06 +00:00
|
|
|
else if (t[0] > 4) actor->s.cstat |= 512 + 2;
|
|
|
|
else if (t[0] > 2) actor->s.cstat |= 2;
|
|
|
|
actor->s.xoffset = Owner->s.xoffset;
|
|
|
|
actor->s.yoffset = Owner->s.yoffset;
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:11:06 +00:00
|
|
|
bool money(DDukeActor* actor, int BLOODPOOL)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-10-21 21:11:06 +00:00
|
|
|
auto s = &actor->s;
|
2020-05-09 18:27:06 +00:00
|
|
|
int sect = s->sectnum;
|
2020-10-21 21:11:06 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-09 18:27:06 +00:00
|
|
|
|
2020-11-14 09:49:46 +00:00
|
|
|
s->xvel = (krand() & 7) + bsin(actor->temp_data[0], -9);
|
2020-10-21 21:11:06 +00:00
|
|
|
actor->temp_data[0] += (krand() & 63);
|
|
|
|
if ((actor->temp_data[0] & 2047) > 512 && (actor->temp_data[0] & 2047) < 1596)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
|
|
|
if (sector[sect].lotag == 2)
|
|
|
|
{
|
|
|
|
if (s->zvel < 64)
|
2020-11-29 12:54:58 +00:00
|
|
|
s->zvel += (gs.gravity >> 5) + (krand() & 7);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
if (s->zvel < 144)
|
2020-11-29 12:54:58 +00:00
|
|
|
s->zvel += (gs.gravity >> 5) + (krand() & 7);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
|
2020-10-21 21:11:06 +00:00
|
|
|
ssp(actor, CLIPMASK0);
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
if ((krand() & 3) == 0)
|
2020-10-21 21:11:06 +00:00
|
|
|
setsprite(actor, s->pos);
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
if (s->sectnum == -1)
|
|
|
|
{
|
2020-10-21 21:11:06 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
int l = getflorzofslope(s->sectnum, s->x, s->y);
|
|
|
|
|
|
|
|
if (s->z > l)
|
|
|
|
{
|
|
|
|
s->z = l;
|
|
|
|
|
2020-10-21 21:11:06 +00:00
|
|
|
insertspriteq(actor);
|
|
|
|
s->picnum++;
|
2020-05-09 18:27:06 +00:00
|
|
|
|
2020-10-21 21:11:06 +00:00
|
|
|
DukeStatIterator it(STAT_MISC);
|
|
|
|
while (auto aa = it.Next())
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-10-21 21:11:06 +00:00
|
|
|
if (aa->s.picnum == BLOODPOOL)
|
|
|
|
if (ldist(actor, aa) < 348)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
|
|
|
s->pal = 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool floorcheck, bool zcheck1, bool zcheck2)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
spritetype* s = &actor->s;
|
2020-05-09 18:27:06 +00:00
|
|
|
int sect = s->sectnum;
|
2020-10-21 21:18:24 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
if (s->xvel > 0) s->xvel--;
|
|
|
|
else s->xvel = 0;
|
|
|
|
|
|
|
|
if (timeout)
|
|
|
|
{
|
|
|
|
if (t[5] < 30 * 10)
|
|
|
|
t[5]++;
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->zvel > 1024 && s->zvel < 1280)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
setsprite(actor, s->pos);
|
2020-05-09 18:27:06 +00:00
|
|
|
sect = s->sectnum;
|
|
|
|
}
|
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
if (callsetsprite) setsprite(actor, s->pos);
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
int l = getflorzofslope(sect, s->x, s->y);
|
|
|
|
int x = getceilzofslope(sect, s->x, s->y);
|
|
|
|
if (x == l || sect < 0 || sect >= MAXSECTORS)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->z < l - (2 << 8))
|
|
|
|
{
|
|
|
|
if (t[1] < 2) t[1]++;
|
|
|
|
else if (sector[sect].lotag != 2)
|
|
|
|
{
|
|
|
|
t[1] = 0;
|
|
|
|
if (zcheck1)
|
|
|
|
{
|
|
|
|
if (t[0] > 6) t[0] = 0;
|
|
|
|
else t[0]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (t[0] > 2)
|
|
|
|
t[0] = 0;
|
|
|
|
else t[0]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->zvel < 6144)
|
|
|
|
{
|
|
|
|
if (sector[sect].lotag == 2)
|
|
|
|
{
|
|
|
|
if (s->zvel < 1024)
|
|
|
|
s->zvel += 48;
|
|
|
|
else s->zvel = 1024;
|
|
|
|
}
|
2020-11-29 12:54:58 +00:00
|
|
|
else s->zvel += gs.gravity - 50;
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
|
2021-01-04 11:36:54 +00:00
|
|
|
s->x += MulScale(s->xvel, bcos(s->ang), 14);
|
|
|
|
s->y += MulScale(s->xvel, bsin(s->ang), 14);
|
2020-05-09 18:27:06 +00:00
|
|
|
s->z += s->zvel;
|
|
|
|
|
|
|
|
if (floorcheck && s->z >= sector[s->sectnum].floorz)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (zcheck2)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (t[2] == 0)
|
|
|
|
{
|
|
|
|
if (s->sectnum == -1)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if ((sector[s->sectnum].floorstat & 2))
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
t[2]++;
|
|
|
|
}
|
|
|
|
l = getflorzofslope(s->sectnum, s->x, s->y);
|
|
|
|
|
|
|
|
s->z = l - (2 << 8);
|
|
|
|
s->xvel = 0;
|
|
|
|
|
|
|
|
if (s->picnum == JIBS6)
|
|
|
|
{
|
|
|
|
t[1]++;
|
|
|
|
if ((t[1] & 3) == 0 && t[0] < 7)
|
|
|
|
t[0]++;
|
|
|
|
if (t[1] > 20)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { s->picnum = JIBS6; t[0] = 0; t[1] = 0; }
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
bool bloodpool(DDukeActor* actor, bool puke, int TIRE)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
spritetype* s = &actor->s;
|
2020-05-09 18:27:06 +00:00
|
|
|
int sect = s->sectnum;
|
2020-10-21 21:18:24 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
if (t[0] == 0)
|
|
|
|
{
|
|
|
|
t[0] = 1;
|
|
|
|
if (sector[sect].floorstat & 2)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
2020-10-21 21:18:24 +00:00
|
|
|
else insertspriteq(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
makeitfall(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
int x;
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-05-09 18:27:06 +00:00
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
s->z = actor->floorz - (FOURSLEIGHT);
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
if (t[2] < 32)
|
|
|
|
{
|
|
|
|
t[2]++;
|
2020-10-21 21:18:24 +00:00
|
|
|
if (actor->picnum == TIRE)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
|
|
|
if (s->xrepeat < 64 && s->yrepeat < 64)
|
|
|
|
{
|
|
|
|
s->xrepeat += krand() & 3;
|
|
|
|
s->yrepeat += krand() & 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (s->xrepeat < 32 && s->yrepeat < 32)
|
|
|
|
{
|
|
|
|
s->xrepeat += krand() & 3;
|
|
|
|
s->yrepeat += krand() & 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x < 844 && s->xrepeat > 6 && s->yrepeat > 6)
|
|
|
|
{
|
|
|
|
if (s->pal == 0 && (krand() & 255) < 16 && !puke)
|
|
|
|
{
|
|
|
|
if (ps[p].boot_amount > 0)
|
|
|
|
ps[p].boot_amount--;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!S_CheckSoundPlaying(DUKE_LONGTERM_PAIN))
|
2020-10-21 21:18:24 +00:00
|
|
|
S_PlayActorSound(DUKE_LONGTERM_PAIN, ps[p].GetActor());
|
|
|
|
ps[p].GetActor()->s.extra--;
|
2020-05-09 18:27:06 +00:00
|
|
|
SetPlayerPal(&ps[p], PalEntry(32, 16, 0, 0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[1] == 1) return false;
|
|
|
|
t[1] = 1;
|
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
if (actor->picnum == TIRE)
|
2020-05-09 18:27:06 +00:00
|
|
|
ps[p].footprintcount = 10;
|
|
|
|
else ps[p].footprintcount = 3;
|
|
|
|
|
|
|
|
ps[p].footprintpal = s->pal;
|
|
|
|
ps[p].footprintshade = s->shade;
|
|
|
|
|
|
|
|
if (t[2] == 32)
|
|
|
|
{
|
|
|
|
s->xrepeat -= 6;
|
|
|
|
s->yrepeat -= 6;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else t[1] = 0;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
void shell(DDukeActor* actor, bool morecheck)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
spritetype* s = &actor->s;
|
2020-05-09 18:27:06 +00:00
|
|
|
int sect = s->sectnum;
|
2020-10-21 21:18:24 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-09 18:27:06 +00:00
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
ssp(actor, CLIPMASK0);
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
if (sect < 0 || morecheck)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sector[sect].lotag == 2)
|
|
|
|
{
|
|
|
|
t[1]++;
|
|
|
|
if (t[1] > 8)
|
|
|
|
{
|
|
|
|
t[1] = 0;
|
|
|
|
t[0]++;
|
|
|
|
t[0] &= 3;
|
|
|
|
}
|
2020-11-29 12:54:58 +00:00
|
|
|
if (s->zvel < 128) s->zvel += (gs.gravity / 13); // 8
|
2020-05-09 18:27:06 +00:00
|
|
|
else s->zvel -= 64;
|
|
|
|
if (s->xvel > 0)
|
|
|
|
s->xvel -= 4;
|
|
|
|
else s->xvel = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t[1]++;
|
|
|
|
if (t[1] > 3)
|
|
|
|
{
|
|
|
|
t[1] = 0;
|
|
|
|
t[0]++;
|
|
|
|
t[0] &= 3;
|
|
|
|
}
|
2020-11-29 12:54:58 +00:00
|
|
|
if (s->zvel < 512) s->zvel += (gs.gravity / 3); // 52;
|
2020-05-09 18:27:06 +00:00
|
|
|
if (s->xvel > 0)
|
|
|
|
s->xvel--;
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
void glasspieces(DDukeActor* actor)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
spritetype* s = &actor->s;
|
2020-05-09 18:27:06 +00:00
|
|
|
int sect = s->sectnum;
|
2020-10-21 21:18:24 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-09 18:27:06 +00:00
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
makeitfall(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
if (s->zvel > 4096) s->zvel = 4096;
|
|
|
|
if (sect < 0)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
if (s->z == actor->floorz - (FOURSLEIGHT) && t[0] < 3)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
|
|
|
s->zvel = -((3 - t[0]) << 8) - (krand() & 511);
|
|
|
|
if (sector[sect].lotag == 2)
|
|
|
|
s->zvel >>= 1;
|
|
|
|
s->xrepeat >>= 1;
|
|
|
|
s->yrepeat >>= 1;
|
|
|
|
if (rnd(96))
|
2020-10-21 21:18:24 +00:00
|
|
|
setsprite(actor, s->pos);
|
2020-05-09 18:27:06 +00:00
|
|
|
t[0]++;//Number of bounces
|
|
|
|
}
|
|
|
|
else if (t[0] == 3)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->xvel > 0)
|
|
|
|
{
|
|
|
|
s->xvel -= 2;
|
|
|
|
s->cstat = ((s->xvel & 3) << 2);
|
|
|
|
}
|
|
|
|
else s->xvel = 0;
|
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
ssp(actor, CLIPMASK0);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:18:24 +00:00
|
|
|
void scrap(DDukeActor* actor, int SCRAP1, int SCRAP6)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
spritetype* s = &actor->s;
|
2020-05-09 18:27:06 +00:00
|
|
|
int sect = s->sectnum;
|
2020-10-21 21:18:24 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
if (s->xvel > 0)
|
|
|
|
s->xvel--;
|
|
|
|
else s->xvel = 0;
|
|
|
|
|
|
|
|
if (s->zvel > 1024 && s->zvel < 1280)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
setsprite(actor, s->pos);
|
2020-05-09 18:27:06 +00:00
|
|
|
sect = s->sectnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->z < sector[sect].floorz - (2 << 8))
|
|
|
|
{
|
|
|
|
if (t[1] < 1) t[1]++;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t[1] = 0;
|
|
|
|
|
|
|
|
if (s->picnum < SCRAP6 + 8)
|
|
|
|
{
|
|
|
|
if (t[0] > 6)
|
|
|
|
t[0] = 0;
|
|
|
|
else t[0]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (t[0] > 2)
|
|
|
|
t[0] = 0;
|
|
|
|
else t[0]++;
|
|
|
|
}
|
|
|
|
}
|
2020-11-29 12:54:58 +00:00
|
|
|
if (s->zvel < 4096) s->zvel += gs.gravity - 50;
|
2021-01-04 11:36:54 +00:00
|
|
|
s->x += MulScale(s->xvel, bcos(s->ang), 14);
|
|
|
|
s->y += MulScale(s->xvel, bsin(s->ang), 14);
|
2020-05-09 18:27:06 +00:00
|
|
|
s->z += s->zvel;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (s->picnum == SCRAP1 && s->yvel > 0)
|
|
|
|
{
|
2020-10-21 21:18:24 +00:00
|
|
|
auto spawned = spawn(actor, s->yvel);
|
|
|
|
setsprite(spawned, s->pos);
|
|
|
|
getglobalz(spawned);
|
|
|
|
spawned->s.hitag = spawned->s.lotag = 0;
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
2020-10-21 21:18:24 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:05:08 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void gutsdir(DDukeActor* actor, short gtype, short n, short p)
|
|
|
|
{
|
|
|
|
int sx, sy;
|
|
|
|
|
|
|
|
if (badguy(actor) && actor->s.xrepeat < 16)
|
|
|
|
sx = sy = 8;
|
|
|
|
else sx = sy = 32;
|
|
|
|
|
|
|
|
int gutz = actor->s.z - (8 << 8);
|
|
|
|
int floorz = getflorzofslope(actor->s.sectnum, actor->s.x, actor->s.y);
|
|
|
|
|
|
|
|
if (gutz > (floorz - (8 << 8)))
|
|
|
|
gutz = floorz - (8 << 8);
|
|
|
|
|
2020-11-29 12:54:58 +00:00
|
|
|
gutz += gs.actorinfo[actor->s.picnum].gutsoffset;
|
2020-10-21 22:05:08 +00:00
|
|
|
|
|
|
|
for (int j = 0; j < n; j++)
|
|
|
|
{
|
|
|
|
int a = krand() & 2047;
|
|
|
|
int r1 = krand();
|
|
|
|
int r2 = krand();
|
|
|
|
// TRANSITIONAL: owned by a player???
|
|
|
|
EGS(actor->s.sectnum, actor->s.x, actor->s.y, gutz, gtype, -32, sx, sy, a, 256 + (r2 & 127), -512 - (r1 & 2047), ps[p].GetActor(), 5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// taken out of moveeffectors
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:39:12 +00:00
|
|
|
void handle_se00(DDukeActor* actor, int LASERLINE)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 21:39:12 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-10-31 21:55:41 +00:00
|
|
|
sectortype *sect = §or[s->sectnum];
|
2020-05-10 07:08:02 +00:00
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
|
|
|
|
int zchange = 0;
|
|
|
|
|
2020-10-21 21:39:12 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-21 21:39:12 +00:00
|
|
|
if (!Owner || Owner->s.lotag == (short)65535)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 21:39:12 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-31 21:55:41 +00:00
|
|
|
int q = sect->extra >> 3;
|
2020-05-10 07:08:02 +00:00
|
|
|
int l = 0;
|
|
|
|
|
2020-10-31 21:55:41 +00:00
|
|
|
if (sect->lotag == 30)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
q >>= 2;
|
|
|
|
|
2020-10-21 21:39:12 +00:00
|
|
|
if (s->extra == 1)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-31 21:55:41 +00:00
|
|
|
if (actor->tempang < 256)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-31 21:55:41 +00:00
|
|
|
actor->tempang += 4;
|
|
|
|
if (actor->tempang >= 256)
|
2020-10-21 21:39:12 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
if (s->clipdist) l = 1;
|
|
|
|
else l = -1;
|
|
|
|
}
|
2020-10-31 21:55:41 +00:00
|
|
|
else actor->tempang = 256;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-31 21:55:41 +00:00
|
|
|
if (sect->floorz > s->z) //z's are touching
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-31 21:55:41 +00:00
|
|
|
sect->floorz -= 512;
|
2020-05-10 07:08:02 +00:00
|
|
|
zchange = -512;
|
2020-10-31 21:55:41 +00:00
|
|
|
if (sect->floorz < s->z)
|
|
|
|
sect->floorz = s->z;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
2020-10-31 21:55:41 +00:00
|
|
|
else if (sect->floorz < s->z) //z's are touching
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-31 21:55:41 +00:00
|
|
|
sect->floorz += 512;
|
2020-05-10 07:08:02 +00:00
|
|
|
zchange = 512;
|
2020-10-31 21:55:41 +00:00
|
|
|
if (sect->floorz > s->z)
|
|
|
|
sect->floorz = s->z;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-21 21:39:12 +00:00
|
|
|
else if (s->extra == 3)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-31 21:55:41 +00:00
|
|
|
if (actor->tempang > 0)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-31 21:55:41 +00:00
|
|
|
actor->tempang -= 4;
|
|
|
|
if (actor->tempang <= 0)
|
2020-10-21 21:39:12 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
if (s->clipdist) l = -1;
|
|
|
|
else l = 1;
|
|
|
|
}
|
2020-10-31 21:55:41 +00:00
|
|
|
else actor->tempang = 0;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-31 21:55:41 +00:00
|
|
|
if (sect->floorz > actor->temp_data[3]) //z's are touching
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-31 21:55:41 +00:00
|
|
|
sect->floorz -= 512;
|
2020-05-10 07:08:02 +00:00
|
|
|
zchange = -512;
|
2020-10-31 21:55:41 +00:00
|
|
|
if (sect->floorz < actor->temp_data[3])
|
|
|
|
sect->floorz = actor->temp_data[3];
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
2020-10-31 21:55:41 +00:00
|
|
|
else if (sect->floorz < actor->temp_data[3]) //z's are touching
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-31 21:55:41 +00:00
|
|
|
sect->floorz += 512;
|
2020-05-10 07:08:02 +00:00
|
|
|
zchange = 512;
|
2020-10-31 21:55:41 +00:00
|
|
|
if (sect->floorz > actor->temp_data[3])
|
|
|
|
sect->floorz = actor->temp_data[3];
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s->ang += (l * q);
|
|
|
|
t[2] += (l * q);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 21:39:12 +00:00
|
|
|
if (Owner->temp_data[0] == 0) return;
|
|
|
|
if (Owner->temp_data[0] == 2)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 21:39:12 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-21 21:39:12 +00:00
|
|
|
if (Owner->s.ang > 1024)
|
2020-05-10 07:08:02 +00:00
|
|
|
l = -1;
|
|
|
|
else l = 1;
|
|
|
|
if (t[3] == 0)
|
2020-10-21 21:39:12 +00:00
|
|
|
t[3] = ldist(actor, Owner);
|
2020-05-10 07:08:02 +00:00
|
|
|
s->xvel = t[3];
|
2020-10-21 21:39:12 +00:00
|
|
|
s->x = Owner->s.x;
|
|
|
|
s->y = Owner->s.y;
|
2020-05-10 07:08:02 +00:00
|
|
|
s->ang += (l * q);
|
|
|
|
t[2] += (l * q);
|
|
|
|
}
|
|
|
|
|
2020-10-31 21:55:41 +00:00
|
|
|
if (l && (sect->floorstat & 64))
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
int p;
|
|
|
|
for (p = connecthead; p >= 0; p = connectpoint2[p])
|
|
|
|
{
|
|
|
|
if (ps[p].cursectnum == s->sectnum && ps[p].on_ground == 1)
|
|
|
|
{
|
2020-10-07 12:13:21 +00:00
|
|
|
ps[p].angle.addadjustment(l * q);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
ps[p].posz += zchange;
|
|
|
|
|
|
|
|
int m, x;
|
2020-10-21 21:39:12 +00:00
|
|
|
rotatepoint(Owner->s.x, Owner->s.y, ps[p].posx, ps[p].posy, (q * l), &m, &x);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
ps[p].bobposx += m - ps[p].posx;
|
|
|
|
ps[p].bobposy += x - ps[p].posy;
|
|
|
|
|
|
|
|
ps[p].posx = m;
|
|
|
|
ps[p].posy = x;
|
|
|
|
|
2020-10-21 21:39:12 +00:00
|
|
|
auto psp = ps[p].GetActor();
|
|
|
|
if (psp->s.extra <= 0)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 21:39:12 +00:00
|
|
|
psp->s.x = m;
|
|
|
|
psp->s.y = x;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-21 21:39:12 +00:00
|
|
|
DukeSectIterator itp(s->sectnum);
|
|
|
|
while (auto ap = itp.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 09:52:38 +00:00
|
|
|
auto sprp = &ap->s;
|
2020-10-13 12:22:23 +00:00
|
|
|
if (sprp->statnum != 3 && sprp->statnum != 4)
|
|
|
|
if (LASERLINE < 0 || sprp->picnum != LASERLINE)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 21:39:12 +00:00
|
|
|
if (sprp->picnum == TILE_APLAYER && ap->GetOwner())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-10-13 12:22:23 +00:00
|
|
|
sprp->ang += (l * q);
|
|
|
|
sprp->ang &= 2047;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-13 12:22:23 +00:00
|
|
|
sprp->z += zchange;
|
2020-10-21 21:39:12 +00:00
|
|
|
rotatepoint(Owner->s.x, Owner->s.y, ap->s.x, ap->s.y, (q* l), &ap->s.x, &ap->s.y);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-10-21 21:39:12 +00:00
|
|
|
ms(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:39:12 +00:00
|
|
|
void handle_se01(DDukeActor *actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 21:39:12 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
int sh = actor->s.hitag;
|
|
|
|
if (actor->GetOwner() == nullptr) //Init
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 21:39:12 +00:00
|
|
|
actor->SetOwner(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-21 21:39:12 +00:00
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
while (auto ac = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 21:39:12 +00:00
|
|
|
if (ac->s.lotag == 19 && ac->s.hitag == sh)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
t[0] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 21:56:46 +00:00
|
|
|
void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 06:51:50 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
|
2020-11-01 06:56:49 +00:00
|
|
|
if (actor->GetOwner() == nullptr)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 06:56:49 +00:00
|
|
|
auto NewOwner = LocateTheLocator(t[3], t[0]);
|
|
|
|
|
|
|
|
if (NewOwner == nullptr)
|
|
|
|
{
|
|
|
|
I_Error("Could not find any locators for SE# 6 and 14 with a hitag of %d.", t[3]);
|
|
|
|
}
|
|
|
|
actor->SetOwner(NewOwner);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 06:56:49 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
|
|
|
int j = ldist(Owner, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-11-01 06:56:49 +00:00
|
|
|
if (j < 1024)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
if (st == 6)
|
2020-11-01 06:56:49 +00:00
|
|
|
if (Owner->s.hitag & 1)
|
2020-05-10 07:08:02 +00:00
|
|
|
t[4] = sc->extra; //Slow it down
|
|
|
|
t[3]++;
|
2020-11-01 06:56:49 +00:00
|
|
|
auto NewOwner = LocateTheLocator(t[3], t[0]);
|
|
|
|
if (NewOwner == nullptr)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
t[3] = 0;
|
2020-11-01 06:56:49 +00:00
|
|
|
NewOwner = LocateTheLocator(0, t[0]);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
2020-11-01 06:56:49 +00:00
|
|
|
if (NewOwner) actor->SetOwner(NewOwner);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 06:56:49 +00:00
|
|
|
Owner = actor->GetOwner();
|
2020-05-10 07:08:02 +00:00
|
|
|
if (s->xvel)
|
|
|
|
{
|
2020-11-01 06:56:49 +00:00
|
|
|
int x = getangle(Owner->s.x - s->x, Owner->s.y - s->y);
|
2020-05-10 07:08:02 +00:00
|
|
|
int q = getincangle(s->ang, x) >> 3;
|
|
|
|
|
|
|
|
t[2] += q;
|
|
|
|
s->ang += q;
|
|
|
|
|
|
|
|
bool statstate = (!checkstat || ((sc->floorstat & 1) == 0 && (sc->ceilingstat & 1) == 0));
|
|
|
|
if (s->xvel == sc->extra)
|
|
|
|
{
|
|
|
|
if (statstate)
|
|
|
|
{
|
2020-11-01 06:51:50 +00:00
|
|
|
if (!S_CheckSoundPlaying(actor->lastvx))
|
|
|
|
S_PlayActorSound(actor->lastvx, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
if ((!checkstat || !statstate) && (ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat & 1) && rnd(8)))
|
|
|
|
{
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-05-10 07:08:02 +00:00
|
|
|
if (x < 20480)
|
|
|
|
{
|
|
|
|
j = s->ang;
|
|
|
|
s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy);
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(actor, RPG);
|
2020-05-10 07:08:02 +00:00
|
|
|
s->ang = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->xvel <= 64 && statstate)
|
2020-11-01 06:51:50 +00:00
|
|
|
S_StopSound(actor->lastvx, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if ((sc->floorz - sc->ceilingz) < (108 << 8))
|
|
|
|
{
|
|
|
|
if (ud.clipping == 0 && s->xvel >= 192)
|
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
2020-11-01 07:00:03 +00:00
|
|
|
{
|
|
|
|
auto psp = ps[p].GetActor();
|
|
|
|
if (psp->s.extra > 0)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
short k = ps[p].cursectnum;
|
|
|
|
updatesector(ps[p].posx, ps[p].posy, &k);
|
|
|
|
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum))
|
|
|
|
{
|
|
|
|
ps[p].posx = s->x;
|
|
|
|
ps[p].posy = s->y;
|
|
|
|
ps[p].cursectnum = s->sectnum;
|
|
|
|
|
2020-11-01 06:51:50 +00:00
|
|
|
setsprite(ps[p].GetActor(), s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
quickkill(&ps[p]);
|
|
|
|
}
|
|
|
|
}
|
2020-11-01 07:00:03 +00:00
|
|
|
}
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
2021-01-04 11:36:54 +00:00
|
|
|
int m = MulScale(s->xvel, bcos(s->ang), 14);
|
|
|
|
x = MulScale(s->xvel, bsin(s->ang), 14);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
2020-11-01 07:00:03 +00:00
|
|
|
{
|
|
|
|
auto psp = ps[p].GetActor();
|
2020-05-10 07:08:02 +00:00
|
|
|
if (sector[ps[p].cursectnum].lotag != 2)
|
|
|
|
{
|
|
|
|
if (po[p].os == s->sectnum)
|
|
|
|
{
|
|
|
|
po[p].ox += m;
|
|
|
|
po[p].oy += x;
|
|
|
|
}
|
|
|
|
|
2020-11-01 07:00:03 +00:00
|
|
|
if (s->sectnum == psp->s.sectnum)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
rotatepoint(s->x, s->y, ps[p].posx, ps[p].posy, q, &ps[p].posx, &ps[p].posy);
|
|
|
|
|
|
|
|
ps[p].posx += m;
|
|
|
|
ps[p].posy += x;
|
|
|
|
|
|
|
|
ps[p].bobposx += m;
|
|
|
|
ps[p].bobposy += x;
|
|
|
|
|
2020-10-07 12:13:21 +00:00
|
|
|
ps[p].angle.addadjustment(q);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (numplayers > 1)
|
|
|
|
{
|
|
|
|
ps[p].oposx = ps[p].posx;
|
|
|
|
ps[p].oposy = ps[p].posy;
|
|
|
|
}
|
2020-11-01 07:00:03 +00:00
|
|
|
if (psp->s.extra <= 0)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 07:00:03 +00:00
|
|
|
psp->s.x = ps[p].posx;
|
|
|
|
psp->s.y = ps[p].posy;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-11-01 07:00:03 +00:00
|
|
|
}
|
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 07:00:03 +00:00
|
|
|
auto sj = &a2->s;
|
2020-10-14 17:24:24 +00:00
|
|
|
if (sj->statnum != 10 && sector[sj->sectnum].lotag != 2 && sj->picnum != SECTOREFFECTOR && sj->picnum != LOCATORS)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 07:03:07 +00:00
|
|
|
rotatepoint(s->x, s->y, sj->x, sj->y, q, &sj->x, &sj->y);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-14 17:24:24 +00:00
|
|
|
sj->x += m;
|
|
|
|
sj->y += x;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-14 17:24:24 +00:00
|
|
|
sj->ang += q;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (numplayers > 1)
|
|
|
|
{
|
2021-01-05 19:20:55 +00:00
|
|
|
sj->backupvec2();
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-01 06:51:50 +00:00
|
|
|
ms(actor);
|
|
|
|
setsprite(actor, s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if ((sc->floorz - sc->ceilingz) < (108 << 8))
|
|
|
|
{
|
|
|
|
if (ud.clipping == 0 && s->xvel >= 192)
|
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
2020-11-01 07:00:03 +00:00
|
|
|
{
|
|
|
|
if (ps[p].GetActor()->s.extra > 0)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
short k = ps[p].cursectnum;
|
|
|
|
updatesector(ps[p].posx, ps[p].posy, &k);
|
|
|
|
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum))
|
|
|
|
{
|
|
|
|
ps[p].oposx = ps[p].posx = s->x;
|
|
|
|
ps[p].oposy = ps[p].posy = s->y;
|
|
|
|
ps[p].cursectnum = s->sectnum;
|
|
|
|
|
2020-11-01 07:00:03 +00:00
|
|
|
setsprite(ps[p].GetActor(), s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
quickkill(&ps[p]);
|
|
|
|
}
|
|
|
|
}
|
2020-11-01 07:00:03 +00:00
|
|
|
}
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-11-01 07:00:43 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
|
|
|
if (Owner)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 07:00:43 +00:00
|
|
|
DukeSectIterator itr(Owner->s.sectnum);
|
|
|
|
while (auto a2 = itr.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 07:00:43 +00:00
|
|
|
if (a2->s.statnum == 1 && badguy(a2) && a2->s.picnum != SECTOREFFECTOR && a2->s.picnum != LOCATORS)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 07:00:43 +00:00
|
|
|
short k = a2->s.sectnum;
|
|
|
|
updatesector(a2->s.x, a2->s.y, &k);
|
|
|
|
if (a2->s.extra >= 0 && k == s->sectnum)
|
|
|
|
{
|
2020-10-21 22:05:08 +00:00
|
|
|
gutsdir(a2, JIBS6, 72, myconnectindex);
|
2020-11-01 07:00:43 +00:00
|
|
|
S_PlayActorSound(SQUISHED, actor);
|
|
|
|
deletesprite(a2);
|
|
|
|
}
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:00:43 +00:00
|
|
|
void handle_se30(DDukeActor *actor, int JIBS6)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:00:43 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
|
2020-10-21 22:00:43 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
|
|
|
if (Owner == nullptr)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
t[3] = !t[3];
|
2020-10-21 22:00:43 +00:00
|
|
|
Owner = LocateTheLocator(t[3], t[0]);
|
|
|
|
actor->SetOwner(Owner);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (t[4] == 1) // Starting to go
|
|
|
|
{
|
2020-10-21 22:00:43 +00:00
|
|
|
if (ldist(Owner, actor) < (2048 - 128))
|
2020-05-10 07:08:02 +00:00
|
|
|
t[4] = 2;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (s->xvel == 0)
|
|
|
|
operateactivators(s->hitag + (!t[3]), -1);
|
|
|
|
if (s->xvel < 256)
|
|
|
|
s->xvel += 16;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (t[4] == 2)
|
|
|
|
{
|
2020-10-21 22:00:43 +00:00
|
|
|
int l = FindDistance2D(Owner->s.x - s->x, Owner->s.y - s->y);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (l <= 128)
|
|
|
|
s->xvel = 0;
|
|
|
|
|
|
|
|
if (s->xvel > 0)
|
|
|
|
s->xvel -= 16;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->xvel = 0;
|
|
|
|
operateactivators(s->hitag + (short)t[3], -1);
|
2020-10-21 22:00:43 +00:00
|
|
|
actor->SetOwner(nullptr);
|
2020-05-10 07:08:02 +00:00
|
|
|
s->ang += 1024;
|
|
|
|
t[4] = 0;
|
2020-11-02 18:54:20 +00:00
|
|
|
fi.operateforcefields(actor, s->hitag);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->xvel)
|
|
|
|
{
|
2021-01-04 11:36:54 +00:00
|
|
|
int l = MulScale(s->xvel, bcos(s->ang), 14);
|
|
|
|
int x = MulScale(s->xvel, bsin(s->ang), 14);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if ((sc->floorz - sc->ceilingz) < (108 << 8))
|
|
|
|
if (ud.clipping == 0)
|
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
2020-10-21 22:00:43 +00:00
|
|
|
{
|
|
|
|
auto psp = ps[p].GetActor();
|
|
|
|
if (psp->s.extra > 0)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
short k = ps[p].cursectnum;
|
|
|
|
updatesector(ps[p].posx, ps[p].posy, &k);
|
|
|
|
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum))
|
|
|
|
{
|
|
|
|
ps[p].posx = s->x;
|
|
|
|
ps[p].posy = s->y;
|
|
|
|
ps[p].cursectnum = s->sectnum;
|
|
|
|
|
2020-10-21 22:00:43 +00:00
|
|
|
setsprite(ps[p].GetActor(), s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
quickkill(&ps[p]);
|
|
|
|
}
|
|
|
|
}
|
2020-10-21 22:00:43 +00:00
|
|
|
}
|
2020-05-10 07:08:02 +00:00
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
|
|
|
{
|
2020-10-21 22:00:43 +00:00
|
|
|
auto psp = ps[p].GetActor();
|
|
|
|
if (psp->s.sectnum == s->sectnum)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
ps[p].posx += l;
|
|
|
|
ps[p].posy += x;
|
|
|
|
|
|
|
|
if (numplayers > 1)
|
|
|
|
{
|
|
|
|
ps[p].oposx = ps[p].posx;
|
|
|
|
ps[p].oposy = ps[p].posy;
|
|
|
|
}
|
|
|
|
|
|
|
|
ps[p].bobposx += l;
|
|
|
|
ps[p].bobposy += x;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (po[p].os == s->sectnum)
|
|
|
|
{
|
|
|
|
po[p].ox += l;
|
|
|
|
po[p].oy += x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:00:43 +00:00
|
|
|
DukeSectIterator its(s->sectnum);
|
|
|
|
while (auto a2 = its.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:00:43 +00:00
|
|
|
auto spa2 = &a2->s;
|
2020-11-01 07:14:40 +00:00
|
|
|
if (spa2->picnum != SECTOREFFECTOR && spa2->picnum != LOCATORS)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 07:14:40 +00:00
|
|
|
spa2->x += l;
|
|
|
|
spa2->y += x;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (numplayers > 1)
|
|
|
|
{
|
2021-01-05 19:20:55 +00:00
|
|
|
spa2->backupvec2();
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:00:43 +00:00
|
|
|
ms(actor);
|
|
|
|
setsprite(actor, s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if ((sc->floorz - sc->ceilingz) < (108 << 8))
|
|
|
|
{
|
|
|
|
if (ud.clipping == 0)
|
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
2020-10-21 22:00:43 +00:00
|
|
|
if (ps[p].GetActor()->s.extra > 0)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
short k = ps[p].cursectnum;
|
|
|
|
updatesector(ps[p].posx, ps[p].posy, &k);
|
|
|
|
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum))
|
|
|
|
{
|
|
|
|
ps[p].posx = s->x;
|
|
|
|
ps[p].posy = s->y;
|
|
|
|
|
|
|
|
ps[p].oposx = ps[p].posx;
|
|
|
|
ps[p].oposy = ps[p].posy;
|
|
|
|
|
|
|
|
ps[p].cursectnum = s->sectnum;
|
|
|
|
|
2020-10-21 22:00:43 +00:00
|
|
|
setsprite(ps[p].GetActor(), s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
quickkill(&ps[p]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:00:43 +00:00
|
|
|
if (Owner)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:00:43 +00:00
|
|
|
DukeSectIterator it(Owner->s.sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:00:43 +00:00
|
|
|
if (a2->s.statnum == 1 && badguy(a2) && a2->s.picnum != SECTOREFFECTOR && a2->s.picnum != LOCATORS)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:00:43 +00:00
|
|
|
// if(a2->s.sectnum != s->sectnum)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:00:43 +00:00
|
|
|
short k = a2->s.sectnum;
|
|
|
|
updatesector(a2->s.x, a2->s.y, &k);
|
|
|
|
if (a2->s.extra >= 0 && k == s->sectnum)
|
|
|
|
{
|
2020-10-21 22:05:08 +00:00
|
|
|
gutsdir(a2, JIBS6, 24, myconnectindex);
|
2020-10-21 22:00:43 +00:00
|
|
|
S_PlayActorSound(SQUISHED, a2);
|
|
|
|
deletesprite(a2);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-21 22:00:43 +00:00
|
|
|
}
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:10:43 +00:00
|
|
|
void handle_se02(DDukeActor *actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:10:43 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
|
|
|
|
if (t[4] > 0 && t[0] == 0)
|
|
|
|
{
|
|
|
|
if (t[4] < sh)
|
|
|
|
t[4]++;
|
|
|
|
else t[0] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[0] > 0)
|
|
|
|
{
|
|
|
|
t[0]++;
|
|
|
|
|
|
|
|
s->xvel = 3;
|
|
|
|
|
|
|
|
if (t[0] > 96)
|
|
|
|
{
|
|
|
|
t[0] = -1; //Stop the quake
|
|
|
|
t[4] = -1;
|
2020-10-21 22:10:43 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((t[0] & 31) == 8)
|
|
|
|
{
|
|
|
|
earthquaketime = 48;
|
2020-10-21 22:10:43 +00:00
|
|
|
S_PlayActorSound(EARTHQUAKE, ps[screenpeek].GetActor());
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (abs(sc->floorheinum - t[5]) < 8)
|
|
|
|
sc->floorheinum = t[5];
|
2021-01-04 12:35:33 +00:00
|
|
|
else sc->floorheinum += (Sgn(t[5] - sc->floorheinum) << 4);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
2021-01-04 11:36:54 +00:00
|
|
|
int m = MulScale(s->xvel, bcos(s->ang), 14);
|
|
|
|
int x = MulScale(s->xvel, bsin(s->ang), 14);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
|
|
|
if (ps[p].cursectnum == s->sectnum && ps[p].on_ground)
|
|
|
|
{
|
|
|
|
ps[p].posx += m;
|
|
|
|
ps[p].posy += x;
|
|
|
|
|
|
|
|
ps[p].bobposx += m;
|
|
|
|
ps[p].bobposy += x;
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:10:43 +00:00
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:10:43 +00:00
|
|
|
auto sj = &a2->s;
|
2020-10-14 17:24:24 +00:00
|
|
|
if (sj->picnum != SECTOREFFECTOR)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-14 17:24:24 +00:00
|
|
|
sj->x += m;
|
|
|
|
sj->y += x;
|
2020-10-21 22:10:43 +00:00
|
|
|
setsprite(a2, sj->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-21 22:10:43 +00:00
|
|
|
ms(actor);
|
|
|
|
setsprite(actor, s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:10:43 +00:00
|
|
|
void handle_se03(DDukeActor *actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:10:43 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
|
|
|
|
if (t[4] == 0) return;
|
2020-10-23 15:44:45 +00:00
|
|
|
int x, p = findplayer(actor, &x);
|
2020-10-21 22:10:43 +00:00
|
|
|
|
2020-11-02 21:39:41 +00:00
|
|
|
int palvals = actor->palvals;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
// if(t[5] > 0) { t[5]--; break; }
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if ((global_random / (sh + 1) & 31) < 4 && !t[2])
|
|
|
|
{
|
2020-05-12 11:43:24 +00:00
|
|
|
// t[5] = 4+(global_random&7);
|
2020-10-21 22:10:43 +00:00
|
|
|
sc->ceilingpal = palvals >> 8;
|
|
|
|
sc->floorpal = palvals & 0xff;
|
2020-05-10 07:08:02 +00:00
|
|
|
t[0] = s->shade + (global_random & 15);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-12 11:43:24 +00:00
|
|
|
// t[5] = 4+(global_random&3);
|
2020-05-10 07:08:02 +00:00
|
|
|
sc->ceilingpal = s->pal;
|
|
|
|
sc->floorpal = s->pal;
|
|
|
|
t[0] = t[3];
|
|
|
|
}
|
|
|
|
|
|
|
|
sc->ceilingshade = t[0];
|
|
|
|
sc->floorshade = t[0];
|
|
|
|
|
|
|
|
auto wal = &wall[sc->wallptr];
|
|
|
|
|
|
|
|
for (x = sc->wallnum; x > 0; x--, wal++)
|
|
|
|
{
|
|
|
|
if (wal->hitag != 1)
|
|
|
|
{
|
|
|
|
wal->shade = t[0];
|
|
|
|
if ((wal->cstat & 2) && wal->nextwall >= 0)
|
|
|
|
{
|
|
|
|
wall[wal->nextwall].shade = wal->shade;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:10:43 +00:00
|
|
|
void handle_se04(DDukeActor *actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:10:43 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
int j;
|
|
|
|
|
2020-11-02 21:39:41 +00:00
|
|
|
int palvals = actor->palvals;
|
2020-10-21 22:10:43 +00:00
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
if ((global_random / (sh + 1) & 31) < 4)
|
|
|
|
{
|
|
|
|
t[1] = s->shade + (global_random & 15);//Got really bright
|
|
|
|
t[0] = s->shade + (global_random & 15);
|
2020-10-21 22:10:43 +00:00
|
|
|
sc->ceilingpal = palvals >> 8;
|
|
|
|
sc->floorpal = palvals & 0xff;
|
2020-05-10 07:08:02 +00:00
|
|
|
j = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t[1] = t[2];
|
|
|
|
t[0] = t[3];
|
|
|
|
|
|
|
|
sc->ceilingpal = s->pal;
|
|
|
|
sc->floorpal = s->pal;
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
sc->floorshade = t[1];
|
|
|
|
sc->ceilingshade = t[1];
|
|
|
|
|
|
|
|
auto wal = &wall[sc->wallptr];
|
|
|
|
|
|
|
|
for (int x = sc->wallnum; x > 0; x--, wal++)
|
|
|
|
{
|
2020-10-21 22:10:43 +00:00
|
|
|
if (j) wal->pal = (palvals & 0xff);
|
2020-05-10 07:08:02 +00:00
|
|
|
else wal->pal = s->pal;
|
|
|
|
|
|
|
|
if (wal->hitag != 1)
|
|
|
|
{
|
|
|
|
wal->shade = t[0];
|
|
|
|
if ((wal->cstat & 2) && wal->nextwall >= 0)
|
|
|
|
wall[wal->nextwall].shade = wal->shade;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:10:43 +00:00
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:10:43 +00:00
|
|
|
auto sj = &a2->s;
|
2020-10-14 17:24:24 +00:00
|
|
|
if (sj->cstat & 16)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
if (sc->ceilingstat & 1)
|
2020-10-14 17:24:24 +00:00
|
|
|
sj->shade = sc->ceilingshade;
|
|
|
|
else sj->shade = sc->floorshade;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[4])
|
2020-10-21 22:10:43 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:14:54 +00:00
|
|
|
void handle_se05(DDukeActor* actor, int FIRELASER)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:14:54 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
2020-10-21 22:14:54 +00:00
|
|
|
int j, l, m;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-23 15:44:45 +00:00
|
|
|
int x, p = findplayer(actor, &x);
|
2020-05-10 07:08:02 +00:00
|
|
|
if (x < 8192)
|
|
|
|
{
|
|
|
|
j = s->ang;
|
|
|
|
s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy);
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(actor, FIRELASER);
|
2020-05-10 07:08:02 +00:00
|
|
|
s->ang = j;
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:14:54 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
|
|
|
if (Owner == nullptr) //Start search
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
t[4] = 0;
|
|
|
|
l = 0x7fffffff;
|
|
|
|
while (1) //Find the shortest dist
|
|
|
|
{
|
2020-10-21 22:14:54 +00:00
|
|
|
auto NewOwner = LocateTheLocator(t[4], -1); //t[0] hold sectnum
|
|
|
|
if (NewOwner == nullptr) break;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-21 22:14:54 +00:00
|
|
|
m = ldist(ps[p].GetActor(), NewOwner);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (l > m)
|
|
|
|
{
|
2020-10-21 22:14:54 +00:00
|
|
|
Owner = NewOwner;
|
2020-05-10 07:08:02 +00:00
|
|
|
l = m;
|
|
|
|
}
|
|
|
|
|
|
|
|
t[4]++;
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:14:54 +00:00
|
|
|
actor->SetOwner(Owner);
|
|
|
|
if (!Owner) return; // Undefined case - was not checked.
|
2021-01-04 12:35:33 +00:00
|
|
|
s->zvel = Sgn(Owner->s.z - s->z) << 4;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
2020-10-21 22:14:54 +00:00
|
|
|
if (ldist(Owner, actor) < 1024)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
short ta;
|
|
|
|
ta = s->ang;
|
|
|
|
s->ang = getangle(ps[p].posx - s->x, ps[p].posy - s->y);
|
|
|
|
s->ang = ta;
|
2020-10-21 22:14:54 +00:00
|
|
|
actor->SetOwner(nullptr);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
else s->xvel = 256;
|
|
|
|
|
2020-10-21 22:14:54 +00:00
|
|
|
x = getangle(Owner->s.x - s->x, Owner->s.y - s->y);
|
|
|
|
int q = getincangle(s->ang, x) >> 3;
|
2020-05-10 07:08:02 +00:00
|
|
|
s->ang += q;
|
|
|
|
|
|
|
|
if (rnd(32))
|
|
|
|
{
|
|
|
|
t[2] += q;
|
|
|
|
sc->ceilingshade = 127;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t[2] +=
|
|
|
|
getincangle(t[2] + 512, getangle(ps[p].posx - s->x, ps[p].posy - s->y)) >> 2;
|
|
|
|
sc->ceilingshade = 0;
|
|
|
|
}
|
2020-10-21 22:14:54 +00:00
|
|
|
j = fi.ifhitbyweapon(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
|
|
|
t[3]++;
|
|
|
|
if (t[3] == 5)
|
|
|
|
{
|
|
|
|
s->zvel += 1024;
|
|
|
|
FTA(7, &ps[myconnectindex]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s->z += s->zvel;
|
|
|
|
sc->ceilingz += s->zvel;
|
|
|
|
sector[t[0]].ceilingz += s->zvel;
|
2020-10-21 22:14:54 +00:00
|
|
|
ms(actor);
|
|
|
|
setsprite(actor, s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:14:54 +00:00
|
|
|
void handle_se08(DDukeActor *actor, bool checkhitag1)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
// work only if its moving
|
2020-10-21 22:14:54 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
|
|
|
|
int x, j = -1;
|
|
|
|
|
2020-10-21 22:14:54 +00:00
|
|
|
if (actor->temp_data[4])
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:14:54 +00:00
|
|
|
actor->temp_data[4]++;
|
|
|
|
if (actor->temp_data[4] > 8)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:14:54 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
j = 1;
|
|
|
|
}
|
2020-07-20 18:40:29 +00:00
|
|
|
else j = getanimationgoal(anim_ceilingz, s->sectnum);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (j >= 0)
|
|
|
|
{
|
|
|
|
short sn;
|
|
|
|
|
2020-10-21 22:14:54 +00:00
|
|
|
if ((sc->lotag & 0x8000) || actor->temp_data[4])
|
2020-05-10 07:08:02 +00:00
|
|
|
x = -t[3];
|
|
|
|
else
|
|
|
|
x = t[3];
|
|
|
|
|
|
|
|
if (st == 9) x = -x;
|
|
|
|
|
2020-10-21 22:14:54 +00:00
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
while (auto ac = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:14:54 +00:00
|
|
|
if (((ac->s.lotag) == st) && (ac->s.hitag) == sh)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:14:54 +00:00
|
|
|
sn = ac->s.sectnum;
|
2020-10-14 16:55:50 +00:00
|
|
|
auto sect = §or[sn];
|
2020-10-21 22:14:54 +00:00
|
|
|
int m = ac->s.shade;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-14 16:55:50 +00:00
|
|
|
auto wal = &wall[sect->wallptr];
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-14 16:55:50 +00:00
|
|
|
for (int l = sect->wallnum; l > 0; l--, wal++)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
if (wal->hitag != 1)
|
|
|
|
{
|
|
|
|
wal->shade += x;
|
|
|
|
|
|
|
|
if (wal->shade < m)
|
|
|
|
wal->shade = m;
|
2020-10-21 22:14:54 +00:00
|
|
|
else if (wal->shade > ac->temp_data[2])
|
|
|
|
wal->shade = ac->temp_data[2];
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (wal->nextwall >= 0)
|
|
|
|
if (wall[wal->nextwall].hitag != 1)
|
|
|
|
wall[wal->nextwall].shade = wal->shade;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-14 16:55:50 +00:00
|
|
|
sect->floorshade += x;
|
|
|
|
sect->ceilingshade += x;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-14 16:55:50 +00:00
|
|
|
if (sect->floorshade < m)
|
|
|
|
sect->floorshade = m;
|
2020-10-21 22:14:54 +00:00
|
|
|
else if (sect->floorshade > ac->temp_data[0])
|
|
|
|
sect->floorshade = ac->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-14 16:55:50 +00:00
|
|
|
if (sect->ceilingshade < m)
|
|
|
|
sect->ceilingshade = m;
|
2020-10-21 22:14:54 +00:00
|
|
|
else if (sect->ceilingshade > ac->temp_data[1])
|
|
|
|
sect->ceilingshade = ac->temp_data[1];
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-14 16:55:50 +00:00
|
|
|
if (checkhitag1 && sect->hitag == 1)
|
2020-10-21 22:14:54 +00:00
|
|
|
sect->ceilingshade = ac->temp_data[1];
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:14:54 +00:00
|
|
|
void handle_se10(DDukeActor* actor, const int* specialtags)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:14:54 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
|
|
|
|
if ((sc->lotag & 0xff) == 27 || (sc->floorz > sc->ceilingz && (sc->lotag & 0xff) != 23) || sc->lotag == (short)32791)
|
|
|
|
{
|
|
|
|
int j = 1;
|
|
|
|
|
|
|
|
if ((sc->lotag & 0xff) != 27)
|
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
|
|
|
if (sc->lotag != 30 && sc->lotag != 31 && sc->lotag != 0)
|
2020-10-21 22:14:54 +00:00
|
|
|
if (s->sectnum == ps[p].GetActor()->s.sectnum)
|
2020-05-10 07:08:02 +00:00
|
|
|
j = 0;
|
|
|
|
|
|
|
|
if (j == 1)
|
|
|
|
{
|
|
|
|
if (t[0] > sh)
|
|
|
|
{
|
|
|
|
if (specialtags) for (int i = 0; specialtags[i]; i++)
|
|
|
|
{
|
2020-07-20 18:40:29 +00:00
|
|
|
if (sector[s->sectnum].lotag == specialtags[i] && getanimationgoal(anim_ceilingz, s->sectnum) >= 0)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-11-02 18:28:59 +00:00
|
|
|
fi.activatebysector(s->sectnum, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
t[0] = 0;
|
|
|
|
}
|
|
|
|
else t[0]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else t[0] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:20:47 +00:00
|
|
|
void handle_se11(DDukeActor *actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
if (t[5] > 0)
|
|
|
|
{
|
|
|
|
t[5]--;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[4])
|
|
|
|
{
|
|
|
|
int startwall, endwall;
|
|
|
|
|
|
|
|
startwall = sc->wallptr;
|
|
|
|
endwall = startwall + sc->wallnum;
|
|
|
|
|
2021-01-03 04:44:57 +00:00
|
|
|
DukeStatIterator it(STAT_ACTOR);
|
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
for (int j = startwall; j < endwall; j++)
|
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
while (auto ac = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
auto sk = &ac->s;
|
|
|
|
if (sk->extra > 0 && badguy(ac) && clipinsidebox(sk->x, sk->y, j, 256L) == 1)
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-01-03 04:44:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int k = (s->yvel >> 3) * t[3];
|
|
|
|
t[2] += k;
|
|
|
|
t[4] += k;
|
|
|
|
ms(actor);
|
|
|
|
setsprite(actor, s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2021-01-03 04:44:57 +00:00
|
|
|
for (int j = startwall; j < endwall; j++)
|
|
|
|
{
|
2020-10-14 16:55:50 +00:00
|
|
|
it.Reset(STAT_PLAYER);
|
2020-10-21 22:20:47 +00:00
|
|
|
while (auto ac = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
auto sk = &ac->s;
|
|
|
|
if (ac->GetOwner() && clipinsidebox(sk->x, sk->y, j, 144L) == 1)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
t[5] = 8; // Delay
|
2021-01-03 04:44:57 +00:00
|
|
|
t[2] -= k;
|
|
|
|
t[4] -= k;
|
|
|
|
ms(actor);
|
|
|
|
setsprite(actor, s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[4] <= -511 || t[4] >= 512)
|
|
|
|
{
|
|
|
|
t[4] = 0;
|
|
|
|
t[2] &= 0xffffff00;
|
2020-10-21 22:20:47 +00:00
|
|
|
ms(actor);
|
|
|
|
setsprite(actor, s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:20:47 +00:00
|
|
|
void handle_se12(DDukeActor *actor, int planeonly)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
if (t[0] == 3 || t[3] == 1) //Lights going off
|
|
|
|
{
|
|
|
|
sc->floorpal = 0;
|
|
|
|
sc->ceilingpal = 0;
|
|
|
|
|
|
|
|
auto wal = &wall[sc->wallptr];
|
|
|
|
for (int j = sc->wallnum; j > 0; j--, wal++)
|
|
|
|
if (wal->hitag != 1)
|
|
|
|
{
|
|
|
|
wal->shade = t[1];
|
|
|
|
wal->pal = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
sc->floorshade = t[1];
|
|
|
|
sc->ceilingshade = t[2];
|
|
|
|
t[0] = 0;
|
|
|
|
|
2020-10-21 22:20:47 +00:00
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
if (a2->s.cstat & 16)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
if (sc->ceilingstat & 1)
|
2020-10-21 22:20:47 +00:00
|
|
|
a2->s.shade = sc->ceilingshade;
|
|
|
|
else a2->s.shade = sc->floorshade;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[3] == 1)
|
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (t[0] == 1) //Lights flickering on
|
|
|
|
{
|
|
|
|
// planeonly 1 is RRRA SE47, planeonly 2 is SE48
|
|
|
|
int compshade = planeonly == 2 ? sc->ceilingshade : sc->floorshade;
|
|
|
|
if (compshade > s->shade)
|
|
|
|
{
|
|
|
|
if (planeonly != 2) sc->floorpal = s->pal;
|
|
|
|
if (planeonly != 1) sc->ceilingpal = s->pal;
|
|
|
|
|
|
|
|
if (planeonly != 2) sc->floorshade -= 2;
|
|
|
|
if (planeonly != 1) sc->ceilingshade -= 2;
|
|
|
|
|
|
|
|
auto wal = &wall[sc->wallptr];
|
|
|
|
for (int j = sc->wallnum; j > 0; j--, wal++)
|
|
|
|
if (wal->hitag != 1)
|
|
|
|
{
|
|
|
|
wal->pal = s->pal;
|
|
|
|
wal->shade -= 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else t[0] = 2;
|
|
|
|
|
2020-10-21 22:20:47 +00:00
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
if (a2->s.cstat & 16)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
if (sc->ceilingstat & 1)
|
2020-10-21 22:20:47 +00:00
|
|
|
a2->s.shade = sc->ceilingshade;
|
|
|
|
else a2->s.shade = sc->floorshade;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:20:47 +00:00
|
|
|
void handle_se13(DDukeActor* actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
if (t[2])
|
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
int j = (s->yvel << 5) | 1;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (s->ang == 512)
|
|
|
|
{
|
2020-11-02 21:39:41 +00:00
|
|
|
if (actor->spriteextra)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
if (abs(t[0] - sc->ceilingz) >= j)
|
2021-01-04 12:35:33 +00:00
|
|
|
sc->ceilingz += Sgn(t[0] - sc->ceilingz) * j;
|
2020-05-10 07:08:02 +00:00
|
|
|
else sc->ceilingz = t[0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (abs(t[1] - sc->floorz) >= j)
|
2021-01-04 12:35:33 +00:00
|
|
|
sc->floorz += Sgn(t[1] - sc->floorz) * j;
|
2020-05-10 07:08:02 +00:00
|
|
|
else sc->floorz = t[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (abs(t[1] - sc->floorz) >= j)
|
2021-01-04 12:35:33 +00:00
|
|
|
sc->floorz += Sgn(t[1] - sc->floorz) * j;
|
2020-05-10 07:08:02 +00:00
|
|
|
else sc->floorz = t[1];
|
|
|
|
if (abs(t[0] - sc->ceilingz) >= j)
|
2021-01-04 12:35:33 +00:00
|
|
|
sc->ceilingz += Sgn(t[0] - sc->ceilingz) * j;
|
2020-05-10 07:08:02 +00:00
|
|
|
sc->ceilingz = t[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[3] == 1)
|
|
|
|
{
|
|
|
|
//Change the shades
|
|
|
|
|
|
|
|
t[3]++;
|
|
|
|
sc->ceilingstat ^= 1;
|
|
|
|
|
|
|
|
if (s->ang == 512)
|
|
|
|
{
|
|
|
|
auto wal = &wall[sc->wallptr];
|
|
|
|
for (j = sc->wallnum; j > 0; j--, wal++)
|
|
|
|
wal->shade = s->shade;
|
|
|
|
|
|
|
|
sc->floorshade = s->shade;
|
|
|
|
|
|
|
|
if (ps[0].one_parallax_sectnum >= 0)
|
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
sc->ceilingpicnum = sector[ps[0].one_parallax_sectnum].ceilingpicnum;
|
|
|
|
sc->ceilingshade = sector[ps[0].one_parallax_sectnum].ceilingshade;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
t[2]++;
|
|
|
|
if (t[2] > 256)
|
|
|
|
{
|
2020-10-21 22:20:47 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (t[2] == 4 && s->ang != 512)
|
2020-10-21 22:20:47 +00:00
|
|
|
for (int x = 0; x < 7; x++) RANDOMSCRAP(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
void handle_se15(DDukeActor* actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:25:11 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
if (t[4])
|
|
|
|
{
|
|
|
|
s->xvel = 16;
|
|
|
|
|
|
|
|
if (t[4] == 1) //Opening
|
|
|
|
{
|
2020-10-21 22:25:11 +00:00
|
|
|
if (t[3] >= (s->yvel >> 3))
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
t[4] = 0; //Turn off the sliders
|
2020-10-21 22:25:11 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
t[3]++;
|
|
|
|
}
|
|
|
|
else if (t[4] == 2)
|
|
|
|
{
|
|
|
|
if (t[3] < 1)
|
|
|
|
{
|
|
|
|
t[4] = 0;
|
2020-10-21 22:25:11 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
t[3]--;
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
ms(actor);
|
|
|
|
setsprite(actor, s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
void handle_se16(DDukeActor* actor, int REACTOR, int REACTOR2)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:25:11 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
|
|
|
|
t[2] += 32;
|
|
|
|
if (sc->floorz < sc->ceilingz) s->shade = 0;
|
|
|
|
|
|
|
|
else if (sc->ceilingz < t[3])
|
|
|
|
{
|
|
|
|
|
|
|
|
//The following code check to see if
|
|
|
|
//there is any other sprites in the sector.
|
|
|
|
//If there isn't, then kill this sectoreffector
|
|
|
|
//itself.....
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
DDukeActor* a2;
|
|
|
|
while ((a2 = it.Next()))
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:25:11 +00:00
|
|
|
if (a2->s.picnum == REACTOR || a2->s.picnum == REACTOR2)
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-10-21 22:25:11 +00:00
|
|
|
if (a2 == nullptr)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:25:11 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else s->shade = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->shade) sc->ceilingz += 1024;
|
|
|
|
else sc->ceilingz -= 512;
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
ms(actor);
|
|
|
|
setsprite(actor, s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
void handle_se17(DDukeActor* actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:25:11 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
int q = t[0] * (s->yvel << 2);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
sc->ceilingz += q;
|
|
|
|
sc->floorz += q;
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto act1 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:25:11 +00:00
|
|
|
if (act1->s.statnum == STAT_PLAYER && act1->GetOwner())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:25:11 +00:00
|
|
|
int p = act1->s.yvel;
|
|
|
|
if (numplayers < 2) ps[p].oposz = ps[p].posz;
|
2020-05-10 07:08:02 +00:00
|
|
|
ps[p].posz += q;
|
|
|
|
ps[p].truefz += q;
|
|
|
|
ps[p].truecz += q;
|
2020-10-21 22:25:11 +00:00
|
|
|
if (numplayers > 1) ps[p].oposz = ps[p].posz;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
2020-12-11 18:17:41 +00:00
|
|
|
if (act1->s.statnum != STAT_EFFECTOR)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2021-01-05 19:20:55 +00:00
|
|
|
act1->s.backupz();
|
2020-10-21 22:25:11 +00:00
|
|
|
act1->s.z += q;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
act1->floorz = sc->floorz;
|
|
|
|
act1->ceilingz = sc->ceilingz;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (t[0]) //If in motion
|
|
|
|
{
|
2020-10-21 22:25:11 +00:00
|
|
|
if (abs(sc->floorz - t[2]) <= s->yvel)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-23 15:46:46 +00:00
|
|
|
activatewarpelevators(actor, 0);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[0] == -1)
|
|
|
|
{
|
|
|
|
if (sc->floorz > t[3])
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (sc->ceilingz < t[4]) return;
|
|
|
|
|
|
|
|
if (t[1] == 0) return;
|
|
|
|
t[1] = 0;
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
DDukeActor* act2;
|
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
while ((act2 = it.Next()))
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:25:11 +00:00
|
|
|
if (actor != act2 && (act2->s.lotag) == 17)
|
|
|
|
if ((sc->hitag - t[0]) == (sector[act2->s.sectnum].hitag) && sh == (act2->s.hitag))
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
if (act2 == nullptr) return;
|
|
|
|
auto spr2 = &act2->s;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
DukeSectIterator its(s->sectnum);
|
|
|
|
while (auto act3 = its.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:25:11 +00:00
|
|
|
auto spr3 = &act3->s;
|
|
|
|
if (spr3->statnum == STAT_PLAYER && act3->GetOwner())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 08:45:37 +00:00
|
|
|
int p = spr3->yvel;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-11-01 08:45:37 +00:00
|
|
|
ps[p].posx += spr2->x - s->x;
|
|
|
|
ps[p].posy += spr2->y - s->y;
|
|
|
|
ps[p].posz = sector[spr2->sectnum].floorz - (sc->floorz - ps[p].posz);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-11-01 08:45:37 +00:00
|
|
|
act3->floorz = sector[spr2->sectnum].floorz;
|
|
|
|
act3->ceilingz = sector[spr2->sectnum].ceilingz;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
ps[p].bobposx = ps[p].oposx = ps[p].posx;
|
|
|
|
ps[p].bobposy = ps[p].oposy = ps[p].posy;
|
|
|
|
ps[p].oposz = ps[p].posz;
|
|
|
|
|
2020-11-01 08:45:37 +00:00
|
|
|
ps[p].truefz = act3->floorz;
|
|
|
|
ps[p].truecz = act3->ceilingz;
|
2020-05-10 07:08:02 +00:00
|
|
|
ps[p].bobcounter = 0;
|
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
changespritesect(act3, spr2->sectnum);
|
2020-11-01 08:45:37 +00:00
|
|
|
ps[p].cursectnum = spr2->sectnum;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
2020-12-11 18:17:41 +00:00
|
|
|
else if (spr3->statnum != STAT_EFFECTOR)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-11-01 08:45:37 +00:00
|
|
|
spr3->x += spr2->x - s->x;
|
|
|
|
spr3->y += spr2->y - s->y;
|
|
|
|
spr3->z = sector[spr2->sectnum].floorz - (sc->floorz - spr3->z);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2021-01-05 09:07:24 +00:00
|
|
|
spr3->backupz();
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-21 22:25:11 +00:00
|
|
|
changespritesect(act3, spr2->sectnum);
|
|
|
|
setsprite(act3, spr3->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-11-01 08:45:37 +00:00
|
|
|
act3->floorz = sector[spr2->sectnum].floorz;
|
|
|
|
act3->ceilingz = sector[spr2->sectnum].ceilingz;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:30:22 +00:00
|
|
|
void handle_se18(DDukeActor *actor, bool morecheck)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
auto sc = §or[actor->s.sectnum];
|
|
|
|
int st = actor->s.lotag;
|
|
|
|
int sh = actor->s.hitag;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (t[0])
|
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
if (actor->s.pal)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
if (actor->s.ang == 512)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
sc->ceilingz -= sc->extra;
|
|
|
|
if (sc->ceilingz <= t[1])
|
|
|
|
{
|
|
|
|
sc->ceilingz = t[1];
|
2020-10-21 22:30:22 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc->floorz += sc->extra;
|
|
|
|
if (morecheck)
|
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
DukeSectIterator it(actor->s.sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
if (a2->s.picnum == TILE_APLAYER && a2->GetOwner())
|
|
|
|
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz += sc->extra;
|
|
|
|
if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && a2->s.statnum != STAT_PROJECTILE)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2021-01-05 19:20:55 +00:00
|
|
|
a2->s.z += sc->extra;
|
2020-10-21 22:30:22 +00:00
|
|
|
a2->floorz = sc->floorz;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sc->floorz >= t[1])
|
|
|
|
{
|
|
|
|
sc->floorz = t[1];
|
2020-10-21 22:30:22 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
if (actor->s.ang == 512)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
sc->ceilingz += sc->extra;
|
2020-10-21 22:30:22 +00:00
|
|
|
if (sc->ceilingz >= actor->s.z)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
sc->ceilingz = actor->s.z;
|
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc->floorz -= sc->extra;
|
|
|
|
if (morecheck)
|
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
DukeSectIterator it(actor->s.sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
if (a2->s.picnum == TILE_APLAYER && a2->GetOwner())
|
|
|
|
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz -= sc->extra;
|
|
|
|
if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && a2->s.statnum != STAT_PROJECTILE)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2021-01-05 19:20:55 +00:00
|
|
|
a2->s.z -= sc->extra;
|
2020-10-21 22:30:22 +00:00
|
|
|
a2->floorz = sc->floorz;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-21 22:30:22 +00:00
|
|
|
if (sc->floorz <= actor->s.z)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
sc->floorz = actor->s.z;
|
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
t[2]++;
|
2020-10-21 22:30:22 +00:00
|
|
|
if (t[2] >= actor->s.hitag)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
t[2] = 0;
|
|
|
|
t[0] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:30:22 +00:00
|
|
|
void handle_se19(DDukeActor *actor, int BIGFORCE)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
auto sc = §or[actor->s.sectnum];
|
|
|
|
int st = actor->s.lotag;
|
|
|
|
int sh = actor->s.hitag;
|
2020-05-10 07:08:02 +00:00
|
|
|
int j, x, q;
|
|
|
|
|
|
|
|
if (t[0])
|
|
|
|
{
|
|
|
|
if (t[0] == 1)
|
|
|
|
{
|
|
|
|
t[0]++;
|
|
|
|
x = sc->wallptr;
|
|
|
|
q = x + sc->wallnum;
|
|
|
|
for (j = x; j < q; j++)
|
|
|
|
if (wall[j].overpicnum == BIGFORCE)
|
|
|
|
{
|
|
|
|
wall[j].cstat &= (128 + 32 + 8 + 4 + 2);
|
|
|
|
wall[j].overpicnum = 0;
|
|
|
|
if (wall[j].nextwall >= 0)
|
|
|
|
{
|
|
|
|
wall[wall[j].nextwall].overpicnum = 0;
|
|
|
|
wall[wall[j].nextwall].cstat &= (128 + 32 + 8 + 4 + 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sc->ceilingz < sc->floorz)
|
2020-10-21 22:30:22 +00:00
|
|
|
sc->ceilingz += actor->s.yvel;
|
2020-05-10 07:08:02 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sc->ceilingz = sc->floorz;
|
|
|
|
|
2020-10-21 22:30:22 +00:00
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
auto a2Owner = a2->GetOwner();
|
|
|
|
if (a2->s.lotag == 0 && a2->s.hitag == sh && a2Owner)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
q = a2Owner->s.sectnum;
|
|
|
|
sector[a2->s.sectnum].floorpal = sector[a2->s.sectnum].ceilingpal = sector[q].floorpal;
|
|
|
|
sector[a2->s.sectnum].floorshade = sector[a2->s.sectnum].ceilingshade = sector[q].floorshade;
|
|
|
|
a2Owner->temp_data[0] = 2;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-21 22:30:22 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else //Not hit yet
|
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
auto hitter = fi.ifhitsectors(actor->s.sectnum);
|
|
|
|
if (hitter)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
FTA(8, &ps[myconnectindex]);
|
|
|
|
|
2020-10-21 22:30:22 +00:00
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
while (auto ac = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
x = ac->s.lotag & 0x7fff;
|
2020-05-10 07:08:02 +00:00
|
|
|
switch (x)
|
|
|
|
{
|
|
|
|
case 0:
|
2020-10-21 22:30:22 +00:00
|
|
|
if (ac->s.hitag == sh && ac->GetOwner())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
q = ac->s.sectnum;
|
|
|
|
sector[q].floorshade = sector[q].ceilingshade = ac->GetOwner()->s.shade;
|
|
|
|
sector[q].floorpal = sector[q].ceilingpal = ac->GetOwner()->s.pal;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
case 12:
|
|
|
|
//case 18:
|
|
|
|
case 19:
|
|
|
|
|
2020-10-21 22:30:22 +00:00
|
|
|
if (sh == ac->s.hitag)
|
|
|
|
if (ac->temp_data[0] == 0)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:30:22 +00:00
|
|
|
ac->temp_data[0] = 1; //Shut them all on
|
|
|
|
ac->SetOwner(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:35:30 +00:00
|
|
|
void handle_se20(DDukeActor* actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:35:30 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
|
|
|
|
if (t[0] == 0) return;
|
|
|
|
if (t[0] == 1) s->xvel = 8;
|
|
|
|
else s->xvel = -8;
|
|
|
|
|
|
|
|
if (s->xvel) //Moving
|
|
|
|
{
|
2021-01-04 11:36:54 +00:00
|
|
|
int x = MulScale(s->xvel, bcos(s->ang), 14);
|
|
|
|
int l = MulScale(s->xvel, bsin(s->ang), 14);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
t[3] += s->xvel;
|
|
|
|
|
|
|
|
s->x += x;
|
|
|
|
s->y += l;
|
|
|
|
|
2020-10-21 22:35:30 +00:00
|
|
|
if (t[3] <= 0 || (t[3] >> 6) >= (s->yvel >> 6))
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
s->x -= x;
|
|
|
|
s->y -= l;
|
|
|
|
t[0] = 0;
|
2020-10-22 19:45:54 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:35:30 +00:00
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:35:30 +00:00
|
|
|
if (a2->s.statnum != 3 && a2->s.zvel == 0)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:35:30 +00:00
|
|
|
a2->s.x += x;
|
|
|
|
a2->s.y += l;
|
|
|
|
setsprite(a2, a2->s.pos);
|
|
|
|
if (sector[a2->s.sectnum].floorstat & 2)
|
|
|
|
if (a2->s.statnum == 2)
|
|
|
|
makeitfall(a2);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dragpoint((short)t[1], wall[t[1]].x + x, wall[t[1]].y + l);
|
|
|
|
dragpoint((short)t[2], wall[t[2]].x + x, wall[t[2]].y + l);
|
|
|
|
|
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
|
|
|
if (ps[p].cursectnum == s->sectnum && ps[p].on_ground)
|
|
|
|
{
|
|
|
|
ps[p].posx += x;
|
|
|
|
ps[p].posy += l;
|
|
|
|
|
|
|
|
ps[p].oposx = ps[p].posx;
|
|
|
|
ps[p].oposy = ps[p].posy;
|
|
|
|
|
2020-11-29 12:54:58 +00:00
|
|
|
setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz + gs.playerheight);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
2020-11-25 19:52:06 +00:00
|
|
|
sc->addfloorxpan(-x / 8.f);
|
|
|
|
sc->addfloorypan(-l / 8.f);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-11-25 19:52:06 +00:00
|
|
|
sc->addceilingxpan(-x / 8.f);
|
|
|
|
sc->addceilingypan(-l / 8.f);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:35:30 +00:00
|
|
|
void handle_se21(DDukeActor* actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:35:30 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
int* lp;
|
|
|
|
|
|
|
|
if (t[0] == 0) return;
|
|
|
|
|
|
|
|
if (s->ang == 1536)
|
|
|
|
lp = &sc->ceilingz;
|
|
|
|
else
|
|
|
|
lp = &sc->floorz;
|
|
|
|
|
|
|
|
if (t[0] == 1) //Decide if the s->sectnum should go up or down
|
|
|
|
{
|
2021-01-04 12:35:33 +00:00
|
|
|
s->zvel = Sgn(s->z - *lp) * (s->yvel << 4);
|
2020-05-10 07:08:02 +00:00
|
|
|
t[0]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sc->extra == 0)
|
|
|
|
{
|
2021-02-26 12:14:44 +00:00
|
|
|
*lp += s->zvel;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (abs(*lp - s->z) < 1024)
|
|
|
|
{
|
|
|
|
*lp = s->z;
|
2020-10-21 22:35:30 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else sc->extra--;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:35:30 +00:00
|
|
|
void handle_se22(DDukeActor* actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:35:30 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
auto sc = §or[actor->s.sectnum];
|
2020-05-10 07:08:02 +00:00
|
|
|
if (t[1])
|
|
|
|
{
|
2020-07-20 18:40:29 +00:00
|
|
|
if (getanimationgoal(anim_ceilingz, t[0]) >= 0)
|
2020-05-10 07:08:02 +00:00
|
|
|
sc->ceilingz += sc->extra * 9;
|
|
|
|
else t[1] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:35:30 +00:00
|
|
|
void handle_se26(DDukeActor* actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:35:30 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
2020-10-21 22:35:30 +00:00
|
|
|
int x, l;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
s->xvel = 32;
|
2021-01-04 11:36:54 +00:00
|
|
|
l = MulScale(s->xvel, bcos(s->ang), 14);
|
|
|
|
x = MulScale(s->xvel, bsin(s->ang), 14);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
s->shade++;
|
|
|
|
if (s->shade > 7)
|
|
|
|
{
|
|
|
|
s->x = t[3];
|
|
|
|
s->y = t[4];
|
|
|
|
sc->floorz -= ((s->zvel * s->shade) - s->zvel);
|
|
|
|
s->shade = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sc->floorz += s->zvel;
|
|
|
|
|
2020-10-21 22:35:30 +00:00
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:35:30 +00:00
|
|
|
if (a2->s.statnum != 3 && a2->s.statnum != 10)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:35:30 +00:00
|
|
|
a2->s.x += l;
|
|
|
|
a2->s.y += x;
|
|
|
|
a2->s.z += s->zvel;
|
|
|
|
setsprite(a2, a2->s.pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
2020-10-21 22:35:30 +00:00
|
|
|
if (ps[p].GetActor()->s.sectnum == s->sectnum && ps[p].on_ground)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
ps[p].fric.x += l << 5;
|
|
|
|
ps[p].fric.y += x << 5;
|
|
|
|
ps[p].posz += s->zvel;
|
|
|
|
}
|
|
|
|
|
2020-10-21 22:35:30 +00:00
|
|
|
ms(actor);
|
|
|
|
setsprite(actor, s->pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:40:57 +00:00
|
|
|
void handle_se27(DDukeActor* actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
int x, p;
|
|
|
|
|
|
|
|
if (ud.recstat == 0) return;
|
|
|
|
|
2020-10-21 22:40:57 +00:00
|
|
|
actor->tempang = s->ang;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-23 15:44:45 +00:00
|
|
|
p = findplayer(actor, &x);
|
2020-10-21 22:40:57 +00:00
|
|
|
if (ps[p].GetActor()->s.extra > 0 && myconnectindex == screenpeek)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
if (t[0] < 0)
|
|
|
|
{
|
2020-11-02 22:53:55 +00:00
|
|
|
ud.cameraactor = actor;
|
2020-05-10 07:08:02 +00:00
|
|
|
t[0]++;
|
|
|
|
}
|
2020-11-02 23:20:51 +00:00
|
|
|
else if (ud.recstat == 2 && ps[p].newOwner == nullptr)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
if (cansee(s->x, s->y, s->z, s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
if (x < (unsigned)sh)
|
|
|
|
{
|
2020-11-02 22:53:55 +00:00
|
|
|
ud.cameraactor = actor;
|
2020-05-10 07:08:02 +00:00
|
|
|
t[0] = 999;
|
|
|
|
s->ang += getincangle(s->ang, getangle(ps[p].posx - s->x, ps[p].posy - s->y)) >> 3;
|
2020-10-21 22:40:57 +00:00
|
|
|
s->yvel = 100 + ((s->z - ps[p].posz) / 257);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else if (t[0] == 999)
|
|
|
|
{
|
2020-11-02 22:53:55 +00:00
|
|
|
if (ud.cameraactor == actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
t[0] = 0;
|
|
|
|
else t[0] = -10;
|
2020-11-02 22:53:55 +00:00
|
|
|
ud.cameraactor = actor;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->ang = getangle(ps[p].posx - s->x, ps[p].posy - s->y);
|
|
|
|
|
|
|
|
if (t[0] == 999)
|
|
|
|
{
|
2020-11-02 22:53:55 +00:00
|
|
|
if (ud.cameraactor == actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
t[0] = 0;
|
|
|
|
else t[0] = -20;
|
2020-11-02 22:53:55 +00:00
|
|
|
ud.cameraactor = actor;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:50:01 +00:00
|
|
|
void handle_se24(DDukeActor *actor, int16_t *list1, int16_t *list2, int TRIPBOMB, int LASERLINE, int CRANE, int shift)
|
|
|
|
{
|
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
|
|
|
|
auto testlist = [](int16_t* list, int val) { for (int i = 0; list[i] > 0; i++) if (list[i] == val) return true; return false; };
|
|
|
|
|
|
|
|
if (t[4]) return;
|
|
|
|
|
2021-01-04 11:36:54 +00:00
|
|
|
int x = MulScale(actor->s.yvel, bcos(actor->s.ang), 18);
|
|
|
|
int l = MulScale(actor->s.yvel, bsin(actor->s.ang), 18);
|
2020-10-21 22:50:01 +00:00
|
|
|
|
|
|
|
DukeSectIterator it(actor->s.sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
|
|
|
{
|
|
|
|
auto s2 = &a2->s;
|
|
|
|
if (s2->zvel >= 0)
|
|
|
|
{
|
|
|
|
switch (s2->statnum)
|
|
|
|
{
|
|
|
|
case 5:
|
|
|
|
if (testlist(list1, s2->picnum))
|
|
|
|
{
|
|
|
|
s2->xrepeat = s2->yrepeat = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (s2->picnum == LASERLINE)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
//[[fallthrough]]
|
|
|
|
case 6:
|
|
|
|
if (s2->picnum == TRIPBOMB) break;
|
|
|
|
//[[fallthrough]]
|
|
|
|
case 1:
|
|
|
|
case 0:
|
|
|
|
if (testlist(list2, s2->picnum) ||
|
|
|
|
wallswitchcheck(a2))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!(s2->picnum >= CRANE && s2->picnum <= (CRANE + 3)))
|
|
|
|
{
|
|
|
|
if (s2->z > (a2->floorz - (16 << 8)))
|
|
|
|
{
|
|
|
|
s2->x += x >> shift;
|
|
|
|
s2->y += l >> shift;
|
|
|
|
|
|
|
|
setsprite(a2, s2->pos);
|
|
|
|
|
|
|
|
if (sector[s2->sectnum].floorstat & 2)
|
|
|
|
if (s2->statnum == 2)
|
|
|
|
makeitfall(a2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto p = connecthead; p >= 0; p = connectpoint2[p])
|
|
|
|
{
|
|
|
|
if (ps[p].cursectnum == actor->s.sectnum && ps[p].on_ground)
|
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
if (abs(ps[p].pos.z - ps[p].truefz) < gs.playerheight + (9 << 8))
|
2020-10-21 22:50:01 +00:00
|
|
|
{
|
|
|
|
ps[p].fric.x += x << 3;
|
|
|
|
ps[p].fric.y += l << 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-11-25 19:52:06 +00:00
|
|
|
sector[actor->s.sectnum].addfloorxpan(actor->s.yvel / 128.f);
|
2020-10-21 22:50:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:59:42 +00:00
|
|
|
void handle_se25(DDukeActor* actor, int t_index, int snd1, int snd2)
|
|
|
|
{
|
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
auto sec = §or[actor->s.sectnum];
|
|
|
|
|
|
|
|
if (sec->floorz <= sec->ceilingz)
|
|
|
|
actor->s.shade = 0;
|
|
|
|
else if (sec->ceilingz <= t[t_index])
|
|
|
|
actor->s.shade = 1;
|
|
|
|
|
|
|
|
if (actor->s.shade)
|
|
|
|
{
|
|
|
|
sec->ceilingz += actor->s.yvel << 4;
|
|
|
|
if (sec->ceilingz > sec->floorz)
|
|
|
|
{
|
|
|
|
sec->ceilingz = sec->floorz;
|
|
|
|
if (pistonsound && snd1 >= 0)
|
|
|
|
S_PlayActorSound(snd1, actor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sec->ceilingz -= actor->s.yvel << 4;
|
|
|
|
if (sec->ceilingz < t[t_index])
|
|
|
|
{
|
|
|
|
sec->ceilingz = t[t_index];
|
|
|
|
if (pistonsound && snd2 >= 0)
|
|
|
|
S_PlayActorSound(snd2, actor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:40:57 +00:00
|
|
|
void handle_se32(DDukeActor *actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
|
|
|
|
if (t[0] == 1)
|
|
|
|
{
|
|
|
|
// Choose dir
|
|
|
|
|
|
|
|
if (t[2] == 1) // Retract
|
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
if (s->ang != 1536)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
if (abs(sc->ceilingz - s->z) < (s->yvel << 1))
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
sc->ceilingz = s->z;
|
2020-10-22 19:45:54 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
t[2] = 0;
|
|
|
|
t[0] = 0;
|
|
|
|
}
|
2021-01-04 12:35:33 +00:00
|
|
|
else sc->ceilingz += Sgn(s->z - sc->ceilingz) * s->yvel;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
if (abs(sc->ceilingz - t[1]) < (s->yvel << 1))
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
sc->ceilingz = t[1];
|
2020-10-22 19:45:54 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
t[2] = 0;
|
|
|
|
t[0] = 0;
|
|
|
|
}
|
2021-01-04 12:35:33 +00:00
|
|
|
else sc->ceilingz += Sgn(t[1] - sc->ceilingz) * s->yvel;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((s->ang & 2047) == 1536)
|
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
if (abs(sc->ceilingz - s->z) < (s->yvel << 1))
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
t[0] = 0;
|
|
|
|
t[2] = !t[2];
|
2020-10-22 19:45:54 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
sc->ceilingz = s->z;
|
|
|
|
}
|
2021-01-04 12:35:33 +00:00
|
|
|
else sc->ceilingz += Sgn(s->z - sc->ceilingz) * s->yvel;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
if (abs(sc->ceilingz - t[1]) < (s->yvel << 1))
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
t[0] = 0;
|
|
|
|
t[2] = !t[2];
|
2020-10-22 19:45:54 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
2021-01-04 12:35:33 +00:00
|
|
|
else sc->ceilingz -= Sgn(s->z - t[1]) * s->yvel;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:40:57 +00:00
|
|
|
void handle_se35(DDukeActor *actor, int SMALLSMOKE, int EXPLOSION2)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
|
|
|
|
if (sc->ceilingz > s->z)
|
|
|
|
for (int j = 0; j < 8; j++)
|
|
|
|
{
|
|
|
|
s->ang += krand() & 511;
|
2020-10-21 22:40:57 +00:00
|
|
|
auto spawned = spawn(actor, SMALLSMOKE);
|
|
|
|
spawned->s.xvel = 96 + (krand() & 127);
|
|
|
|
ssp(spawned, CLIPMASK0);
|
|
|
|
setsprite(spawned, spawned->s.pos);
|
2020-05-10 07:08:02 +00:00
|
|
|
if (rnd(16))
|
2020-10-21 22:40:57 +00:00
|
|
|
spawn(actor, EXPLOSION2);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (t[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
sc->ceilingz += s->yvel;
|
|
|
|
if (sc->ceilingz > sc->floorz)
|
|
|
|
sc->floorz = sc->ceilingz;
|
|
|
|
if (sc->ceilingz > s->z + (32 << 8))
|
|
|
|
t[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sc->ceilingz -= (s->yvel << 2);
|
|
|
|
if (sc->ceilingz < t[4])
|
|
|
|
{
|
|
|
|
sc->ceilingz = t[4];
|
|
|
|
t[0] = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:40:57 +00:00
|
|
|
void handle_se128(DDukeActor *actor)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
auto sc = §or[actor->s.sectnum];
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
auto wal = &wall[t[2]];
|
|
|
|
|
|
|
|
if (wal->cstat | 32)
|
|
|
|
{
|
|
|
|
wal->cstat &= (255 - 32);
|
|
|
|
wal->cstat |= 16;
|
|
|
|
if (wal->nextwall >= 0)
|
|
|
|
{
|
|
|
|
wall[wal->nextwall].cstat &= (255 - 32);
|
|
|
|
wall[wal->nextwall].cstat |= 16;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else return;
|
|
|
|
|
|
|
|
wal->overpicnum++;
|
|
|
|
if (wal->nextwall >= 0)
|
|
|
|
wall[wal->nextwall].overpicnum++;
|
|
|
|
|
|
|
|
if (t[0] < t[1]) t[0]++;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wal->cstat &= (128 + 32 + 8 + 4 + 2);
|
|
|
|
if (wal->nextwall >= 0)
|
|
|
|
wall[wal->nextwall].cstat &= (128 + 32 + 8 + 4 + 2);
|
2020-10-21 22:40:57 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 22:40:57 +00:00
|
|
|
void handle_se130(DDukeActor *actor, int countmax, int EXPLOSION2)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
auto sc = §or[actor->s.sectnum];
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (t[0] > countmax)
|
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:08:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else t[0]++;
|
|
|
|
|
|
|
|
int x = sc->floorz - sc->ceilingz;
|
|
|
|
|
|
|
|
if (rnd(64))
|
|
|
|
{
|
2020-10-21 22:40:57 +00:00
|
|
|
auto k = spawn(actor, EXPLOSION2);
|
2020-10-24 07:05:54 +00:00
|
|
|
k->s.xrepeat = k->s.yrepeat = 2 + (krand() & 7);
|
|
|
|
k->s.z = sc->floorz - (krand() % x);
|
|
|
|
k->s.ang += 256 - (krand() % 511);
|
|
|
|
k->s.xvel = krand() & 127;
|
2020-05-10 07:08:02 +00:00
|
|
|
ssp(k, CLIPMASK0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-13 22:04:14 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 23:04:13 +00:00
|
|
|
void handle_se31(DDukeActor* actor, bool choosedir)
|
|
|
|
{
|
|
|
|
auto s = &actor->s;
|
|
|
|
int* t = &actor->temp_data[0];
|
|
|
|
auto sec = §or[s->sectnum];
|
|
|
|
|
|
|
|
if (t[0] == 1)
|
|
|
|
{
|
|
|
|
// Choose dir
|
|
|
|
|
|
|
|
if (choosedir && t[3] > 0)
|
|
|
|
{
|
|
|
|
t[3]--;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[2] == 1) // Retract
|
|
|
|
{
|
|
|
|
if (s->ang != 1536)
|
|
|
|
{
|
|
|
|
if (abs(sec->floorz - s->z) < s->yvel)
|
|
|
|
{
|
|
|
|
sec->floorz = s->z;
|
|
|
|
t[2] = 0;
|
|
|
|
t[0] = 0;
|
|
|
|
if (choosedir) t[3] = s->hitag;
|
2020-10-22 19:45:54 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-10-21 23:04:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-04 12:35:33 +00:00
|
|
|
int l = Sgn(s->z - sec->floorz) * s->yvel;
|
2020-10-21 23:04:13 +00:00
|
|
|
sec->floorz += l;
|
|
|
|
|
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
|
|
|
{
|
|
|
|
if (a2->s.picnum == TILE_APLAYER && a2->GetOwner())
|
|
|
|
if (ps[a2->PlayerIndex()].on_ground == 1)
|
|
|
|
ps[a2->PlayerIndex()].posz += l;
|
|
|
|
if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && (!choosedir || a2->s.statnum != STAT_PROJECTILE))
|
|
|
|
{
|
2020-12-11 18:17:41 +00:00
|
|
|
a2->s.z += l;
|
2020-10-21 23:04:13 +00:00
|
|
|
a2->floorz = sec->floorz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (abs(sec->floorz - t[1]) < s->yvel)
|
|
|
|
{
|
|
|
|
sec->floorz = t[1];
|
2020-10-22 19:45:54 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-10-21 23:04:13 +00:00
|
|
|
t[2] = 0;
|
|
|
|
t[0] = 0;
|
|
|
|
if (choosedir) t[3] = s->hitag;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-04 12:35:33 +00:00
|
|
|
int l = Sgn(t[1] - sec->floorz) * s->yvel;
|
2020-10-21 23:04:13 +00:00
|
|
|
sec->floorz += l;
|
|
|
|
|
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
|
|
|
{
|
|
|
|
if (a2->s.picnum == TILE_APLAYER && a2->GetOwner())
|
|
|
|
if (ps[a2->PlayerIndex()].on_ground == 1)
|
|
|
|
ps[a2->PlayerIndex()].posz += l;
|
|
|
|
if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && (!choosedir || a2->s.statnum != STAT_PROJECTILE))
|
|
|
|
{
|
2020-12-11 18:17:41 +00:00
|
|
|
a2->s.z += l;
|
2020-10-21 23:04:13 +00:00
|
|
|
a2->floorz = sec->floorz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((s->ang & 2047) == 1536)
|
|
|
|
{
|
|
|
|
if (abs(s->z - sec->floorz) < s->yvel)
|
|
|
|
{
|
2020-10-22 19:45:54 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-10-21 23:04:13 +00:00
|
|
|
t[0] = 0;
|
|
|
|
t[2] = 1;
|
|
|
|
if (choosedir) t[3] = s->hitag;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-04 12:35:33 +00:00
|
|
|
int l = Sgn(s->z - sec->floorz) * s->yvel;
|
2020-10-21 23:04:13 +00:00
|
|
|
sec->floorz += l;
|
|
|
|
|
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
|
|
|
{
|
|
|
|
if (a2->s.picnum == TILE_APLAYER && a2->GetOwner())
|
|
|
|
if (ps[a2->PlayerIndex()].on_ground == 1)
|
|
|
|
ps[a2->PlayerIndex()].posz += l;
|
|
|
|
if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && (!choosedir || a2->s.statnum != STAT_PROJECTILE))
|
|
|
|
{
|
2020-12-11 18:17:41 +00:00
|
|
|
a2->s.z += l;
|
2020-10-21 23:04:13 +00:00
|
|
|
a2->floorz = sec->floorz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (abs(sec->floorz - t[1]) < s->yvel)
|
|
|
|
{
|
|
|
|
t[0] = 0;
|
2020-10-22 19:45:54 +00:00
|
|
|
callsound(s->sectnum, actor);
|
2020-10-21 23:04:13 +00:00
|
|
|
t[2] = 1;
|
|
|
|
t[3] = s->hitag;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-04 12:35:33 +00:00
|
|
|
int l = Sgn(s->z - t[1]) * s->yvel;
|
2020-10-21 23:04:13 +00:00
|
|
|
sec->floorz -= l;
|
|
|
|
|
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
|
|
|
{
|
|
|
|
if (a2->s.picnum ==TILE_APLAYER && a2->GetOwner())
|
|
|
|
if (ps[a2->PlayerIndex()].on_ground == 1)
|
|
|
|
ps[a2->PlayerIndex()].posz -= l;
|
|
|
|
if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && (!choosedir || a2->s.statnum != STAT_PROJECTILE))
|
|
|
|
{
|
2020-12-11 18:17:41 +00:00
|
|
|
a2->s.z -= l;
|
2020-10-21 23:04:13 +00:00
|
|
|
a2->floorz = sec->floorz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 23:10:56 +00:00
|
|
|
void getglobalz(DDukeActor* actor)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:10:56 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int zr;
|
|
|
|
Collision hz, lz;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
if( s->statnum == STAT_PLAYER || s->statnum == STAT_STANDABLE || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_ACTOR || s->statnum == STAT_PROJECTILE)
|
|
|
|
{
|
|
|
|
if(s->statnum == STAT_PROJECTILE)
|
|
|
|
zr = 4;
|
|
|
|
else zr = 127;
|
|
|
|
|
2020-10-21 23:10:56 +00:00
|
|
|
getzrange_ex(s->x, s->y, s->z - (FOURSLEIGHT), s->sectnum, &actor->ceilingz, hz, &actor->floorz, lz, zr, CLIPMASK0);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-10-21 23:10:56 +00:00
|
|
|
if( lz.type == kHitSprite && (lz.actor->s.cstat&48) == 0 )
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:10:56 +00:00
|
|
|
if( badguy(lz.actor) && lz.actor->s.pal != 1)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:10:56 +00:00
|
|
|
if( s->statnum != STAT_PROJECTILE)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:10:56 +00:00
|
|
|
actor->aflags |= SFLAG_NOFLOORSHADOW;
|
|
|
|
//actor->dispicnum = -4; // No shadows on actors
|
2020-05-13 22:04:14 +00:00
|
|
|
s->xvel = -256;
|
2020-10-21 23:10:56 +00:00
|
|
|
ssp(actor, CLIPMASK0);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-21 23:10:56 +00:00
|
|
|
else if(lz.actor->s.picnum == TILE_APLAYER && badguy(actor) )
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:10:56 +00:00
|
|
|
actor->aflags |= SFLAG_NOFLOORSHADOW;
|
|
|
|
//actor->dispicnum = -4; // No shadows on actors
|
2020-05-13 22:04:14 +00:00
|
|
|
s->xvel = -256;
|
2020-10-21 23:10:56 +00:00
|
|
|
ssp(actor, CLIPMASK0);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-10-21 23:10:56 +00:00
|
|
|
else if(s->statnum == STAT_PROJECTILE && lz.actor->s.picnum == TILE_APLAYER && actor->GetOwner() == actor)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:10:56 +00:00
|
|
|
actor->ceilingz = sector[s->sectnum].ceilingz;
|
|
|
|
actor->floorz = sector[s->sectnum].floorz;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-21 23:10:56 +00:00
|
|
|
actor->ceilingz = sector[s->sectnum].ceilingz;
|
|
|
|
actor->floorz = sector[s->sectnum].floorz;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 23:11:38 +00:00
|
|
|
void makeitfall(DDukeActor* actor)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:11:38 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
int c;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-05-14 10:14:03 +00:00
|
|
|
if( fi.floorspace(s->sectnum) )
|
2020-05-13 22:04:14 +00:00
|
|
|
c = 0;
|
|
|
|
else
|
|
|
|
{
|
2020-05-14 10:14:03 +00:00
|
|
|
if( fi.ceilingspace(s->sectnum) || sector[s->sectnum].lotag == ST_2_UNDERWATER)
|
2020-11-29 12:54:58 +00:00
|
|
|
c = gs.gravity/6;
|
|
|
|
else c = gs.gravity;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
2020-10-21 23:11:38 +00:00
|
|
|
c = adjustfall(actor, c); // this accesses sprite indices and cannot be in shared code. Should be done better.
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2020-10-21 23:11:38 +00:00
|
|
|
if ((s->statnum == STAT_ACTOR || s->statnum == STAT_PLAYER || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_STANDABLE))
|
|
|
|
{
|
|
|
|
Collision c;
|
|
|
|
getzrange_ex(s->x, s->y, s->z - (FOURSLEIGHT), s->sectnum, &actor->ceilingz, c, &actor->floorz, c, 127, CLIPMASK0);
|
|
|
|
}
|
2020-05-13 22:04:14 +00:00
|
|
|
else
|
|
|
|
{
|
2020-10-21 23:11:38 +00:00
|
|
|
actor->ceilingz = sector[s->sectnum].ceilingz;
|
|
|
|
actor->floorz = sector[s->sectnum].floorz;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2020-10-21 23:11:38 +00:00
|
|
|
if( s->z < actor->floorz-(FOURSLEIGHT) )
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
|
|
|
if( sector[s->sectnum].lotag == 2 && s->zvel > 3122 )
|
|
|
|
s->zvel = 3144;
|
|
|
|
if(s->zvel < 6144)
|
|
|
|
s->zvel += c;
|
|
|
|
else s->zvel = 6144;
|
|
|
|
s->z += s->zvel;
|
|
|
|
}
|
2020-10-21 23:11:38 +00:00
|
|
|
if( s->z >= actor->floorz-(FOURSLEIGHT) )
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:11:38 +00:00
|
|
|
s->z = actor->floorz - FOURSLEIGHT;
|
2020-05-13 22:04:14 +00:00
|
|
|
s->zvel = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 23:12:16 +00:00
|
|
|
int dodge(DDukeActor* actor)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:12:16 +00:00
|
|
|
auto s = &actor->s;
|
2020-11-14 09:49:46 +00:00
|
|
|
int bx, by, mx, my, bxvect, byvect, d;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
mx = s->x;
|
|
|
|
my = s->y;
|
|
|
|
|
2020-10-21 23:12:16 +00:00
|
|
|
DukeStatIterator it(STAT_PROJECTILE);
|
|
|
|
while (auto ac = it.Next())
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:12:16 +00:00
|
|
|
auto si = &ac->s;
|
|
|
|
if (ac->GetOwner() == ac || si->sectnum != s->sectnum)
|
2020-05-13 22:04:14 +00:00
|
|
|
continue;
|
|
|
|
|
2020-10-14 16:55:50 +00:00
|
|
|
bx = si->x - mx;
|
|
|
|
by = si->y - my;
|
2020-11-14 09:49:46 +00:00
|
|
|
bxvect = bcos(si->ang);
|
|
|
|
byvect = bsin(si->ang);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-14 09:49:46 +00:00
|
|
|
if (bcos(s->ang) * bx + bsin(s->ang) * by >= 0)
|
2020-05-13 22:04:14 +00:00
|
|
|
if (bxvect * bx + byvect * by < 0)
|
|
|
|
{
|
|
|
|
d = bxvect * by - byvect * bx;
|
|
|
|
if (abs(d) < 65536 * 64)
|
|
|
|
{
|
|
|
|
s->ang -= 512 + (krand() & 1024);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 23:12:16 +00:00
|
|
|
int furthestangle(DDukeActor *actor, int angs)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:12:16 +00:00
|
|
|
auto s = &actor->s;
|
2020-10-23 21:18:05 +00:00
|
|
|
short j, hitsect, hitwall, furthest_angle, angincs;
|
2020-05-13 22:04:14 +00:00
|
|
|
int hx, hy, hz, d, greatestd;
|
2020-10-23 21:18:05 +00:00
|
|
|
DDukeActor* dd;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
greatestd = -(1 << 30);
|
|
|
|
angincs = 2048 / angs;
|
|
|
|
|
2020-05-14 19:42:11 +00:00
|
|
|
if (s->picnum != TILE_APLAYER)
|
2020-10-21 23:12:16 +00:00
|
|
|
if ((actor->temp_data[0] & 63) > 2) return(s->ang + 1024);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
for (j = s->ang; j < (2048 + s->ang); j += angincs)
|
|
|
|
{
|
2020-11-14 09:49:46 +00:00
|
|
|
hitscan(s->x, s->y, s->z - (8 << 8), s->sectnum, bcos(j), bsin(j), 0, &hitsect, &hitwall, &dd, &hx, &hy, &hz, CLIPMASK1);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
d = abs(hx - s->x) + abs(hy - s->y);
|
|
|
|
|
|
|
|
if (d > greatestd)
|
|
|
|
{
|
|
|
|
greatestd = d;
|
|
|
|
furthest_angle = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (furthest_angle & 2047);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 23:12:16 +00:00
|
|
|
int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, int* dax, int* day)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-21 23:12:16 +00:00
|
|
|
auto s = &actor->s;
|
2020-10-23 21:18:05 +00:00
|
|
|
short j, hitsect, hitwall, angincs;
|
2020-05-13 22:04:14 +00:00
|
|
|
int hx, hy, hz, d, da;//, d, cd, ca,tempx,tempy,cx,cy;
|
2020-10-23 21:18:05 +00:00
|
|
|
DDukeActor* dd;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-10-21 23:12:16 +00:00
|
|
|
if ((actor->temp_data[0] & 63)) return -1;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
if (ud.multimode < 2 && ud.player_skill < 3)
|
|
|
|
angincs = 2048 / 2;
|
|
|
|
else angincs = 2048 / (1 + (krand() & 1));
|
|
|
|
|
2020-10-21 23:12:16 +00:00
|
|
|
auto ts = &tosee->s;
|
2020-05-13 22:04:14 +00:00
|
|
|
for (j = ts->ang; j < (2048 + ts->ang); j += (angincs - (krand() & 511)))
|
|
|
|
{
|
2020-11-14 09:49:46 +00:00
|
|
|
hitscan(ts->x, ts->y, ts->z - (16 << 8), ts->sectnum, bcos(j), bsin(j), 16384 - (krand() & 32767),
|
2020-10-23 21:18:05 +00:00
|
|
|
&hitsect, &hitwall, &dd, &hx, &hy, &hz, CLIPMASK1);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
d = abs(hx - ts->x) + abs(hy - ts->y);
|
|
|
|
da = abs(hx - s->x) + abs(hy - s->y);
|
|
|
|
|
|
|
|
if (d < da)
|
|
|
|
if (cansee(hx, hy, hz, hitsect, s->x, s->y, s->z - (16 << 8), s->sectnum))
|
|
|
|
{
|
|
|
|
*dax = hx;
|
|
|
|
*day = hy;
|
|
|
|
return hitsect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-01 09:45:09 +00:00
|
|
|
void alterang(int ang, DDukeActor* actor, int playernum)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 09:45:09 +00:00
|
|
|
auto s = &actor->s;
|
2020-05-13 22:04:14 +00:00
|
|
|
short aang, angdif, goalang, j;
|
|
|
|
int ticselapsed;
|
2020-10-22 14:40:48 +00:00
|
|
|
int* t = actor->temp_data;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-10-22 14:40:48 +00:00
|
|
|
auto moveptr = &ScriptCode[t[1]];
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-10-22 14:40:48 +00:00
|
|
|
ticselapsed = (t[0]) & 31;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 09:45:09 +00:00
|
|
|
aang = s->ang;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 09:45:09 +00:00
|
|
|
s->xvel += (*moveptr - s->xvel) / 5;
|
|
|
|
if (s->zvel < 648) s->zvel += ((*(moveptr + 1) << 4) - s->zvel) / 5;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-10-22 14:40:48 +00:00
|
|
|
if (isRRRA() && (ang & windang))
|
2020-11-01 09:45:09 +00:00
|
|
|
s->ang = WindDir;
|
2020-10-22 14:40:48 +00:00
|
|
|
else if (ang & seekplayer)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 09:45:09 +00:00
|
|
|
auto holoduke = !isRR()? ps[playernum].holoduke_on : nullptr;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-02 21:26:32 +00:00
|
|
|
// NOTE: looks like 'Owner' is set to target sprite ID...
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 09:45:09 +00:00
|
|
|
if (holoduke && cansee(holoduke->s.x, holoduke->s.y, holoduke->s.z, holoduke->s.sectnum, s->x, s->y, s->z, s->sectnum))
|
2020-10-22 14:40:48 +00:00
|
|
|
actor->SetOwner(holoduke);
|
2020-11-01 09:45:09 +00:00
|
|
|
else actor->SetOwner(ps[playernum].GetActor());
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-10-22 14:40:48 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
|
|
|
if (Owner->s.picnum == TILE_APLAYER)
|
2020-11-01 09:45:09 +00:00
|
|
|
goalang = getangle(actor->lastvx - s->x, actor->lastvy - s->y);
|
2020-05-13 22:04:14 +00:00
|
|
|
else
|
2020-11-01 09:45:09 +00:00
|
|
|
goalang = getangle(Owner->s.x - s->x, Owner->s.y - s->y);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 09:45:09 +00:00
|
|
|
if (s->xvel && s->picnum != TILE_DRONE)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
|
|
|
angdif = getincangle(aang, goalang);
|
|
|
|
|
|
|
|
if (ticselapsed < 2)
|
|
|
|
{
|
|
|
|
if (abs(angdif) < 256)
|
|
|
|
{
|
|
|
|
j = 128 - (krand() & 256);
|
2020-11-01 09:45:09 +00:00
|
|
|
s->ang += j;
|
2020-10-22 14:40:48 +00:00
|
|
|
if (hits(actor) < 844)
|
2020-11-01 09:45:09 +00:00
|
|
|
s->ang -= j;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ticselapsed > 18 && ticselapsed < 26) // choose
|
|
|
|
{
|
2020-11-01 09:45:09 +00:00
|
|
|
if (abs(angdif >> 2) < 128) s->ang = goalang;
|
|
|
|
else s->ang += angdif >> 2;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-01 09:45:09 +00:00
|
|
|
else s->ang = goalang;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ticselapsed < 1)
|
|
|
|
{
|
|
|
|
j = 2;
|
2020-10-22 14:40:48 +00:00
|
|
|
if (ang & furthestdir)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-22 14:40:48 +00:00
|
|
|
goalang = furthestangle(actor, j);
|
2020-11-01 09:45:09 +00:00
|
|
|
s->ang = goalang;
|
|
|
|
actor->SetOwner(ps[playernum].GetActor());
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2020-10-22 14:40:48 +00:00
|
|
|
if (ang & fleeenemy)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-22 14:40:48 +00:00
|
|
|
goalang = furthestangle(actor, j);
|
2020-11-01 09:45:09 +00:00
|
|
|
s->ang = goalang; // += angdif; // = getincangle(aang,goalang)>>1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 07:07:07 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// the indirections here are to keep this core function free of game references
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-01 09:49:50 +00:00
|
|
|
void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(DDukeActor*, int))
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
auto s = &actor->s;
|
|
|
|
s->xoffset = 0;
|
|
|
|
s->yoffset = 0;
|
2020-05-14 07:07:07 +00:00
|
|
|
// if(!gotz)
|
|
|
|
{
|
2020-05-14 10:52:59 +00:00
|
|
|
int c;
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-11-01 09:49:50 +00:00
|
|
|
int sphit = fallspecial? fallspecial(actor, playernum) : 0;
|
|
|
|
if (fi.floorspace(s->sectnum))
|
2020-05-14 07:07:07 +00:00
|
|
|
c = 0;
|
|
|
|
else
|
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
if (fi.ceilingspace(s->sectnum) || sector[s->sectnum].lotag == 2)
|
2020-11-29 12:54:58 +00:00
|
|
|
c = gs.gravity / 6;
|
|
|
|
else c = gs.gravity;
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 09:49:50 +00:00
|
|
|
if (actor->cgg <= 0 || (sector[s->sectnum].floorstat & 2))
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-10-22 16:51:20 +00:00
|
|
|
getglobalz(actor);
|
|
|
|
actor->cgg = 6;
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
2020-10-22 16:51:20 +00:00
|
|
|
else actor->cgg--;
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-11-01 09:49:50 +00:00
|
|
|
if (s->z < (actor->floorz - FOURSLEIGHT))
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
s->zvel += c;
|
|
|
|
s->z += s->zvel;
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-11-01 09:49:50 +00:00
|
|
|
if (s->zvel > 6144) s->zvel = 6144;
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
s->z = actor->floorz - FOURSLEIGHT;
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-11-01 09:49:50 +00:00
|
|
|
if (badguy(actor) || (s->picnum == TILE_APLAYER && actor->GetOwner()))
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
|
|
|
|
2020-11-01 09:49:50 +00:00
|
|
|
if (s->zvel > 3084 && s->extra <= 1)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
if (s->pal != 1 && s->picnum != DRONE)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
if (s->picnum == TILE_APLAYER && s->extra > 0)
|
2020-05-14 07:07:07 +00:00
|
|
|
goto SKIPJIBS;
|
|
|
|
if (sphit)
|
|
|
|
{
|
2020-10-22 17:21:21 +00:00
|
|
|
fi.guts(actor, JIBS6, 5, playernum);
|
2020-10-22 16:51:20 +00:00
|
|
|
S_PlayActorSound(squished, actor);
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-22 17:21:21 +00:00
|
|
|
fi.guts(actor, JIBS6, 15, playernum);
|
2020-10-22 16:51:20 +00:00
|
|
|
S_PlayActorSound(squished, actor);
|
|
|
|
spawn(actor, BLOODPOOL);
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SKIPJIBS:
|
|
|
|
|
2020-10-22 16:51:20 +00:00
|
|
|
actor->picnum = SHOTSPARK1;
|
|
|
|
actor->extra = 1;
|
2020-11-01 09:49:50 +00:00
|
|
|
s->zvel = 0;
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
2020-11-01 09:49:50 +00:00
|
|
|
else if (s->zvel > 2048 && sector[s->sectnum].lotag != 1)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
|
|
|
|
2020-11-01 09:49:50 +00:00
|
|
|
short j = s->sectnum;
|
|
|
|
int x = s->x, y = s->y, z = s->z;
|
2020-05-14 07:07:07 +00:00
|
|
|
pushmove(&x, &y, &z, &j, 128, (4 << 8), (4 << 8), CLIPMASK0);
|
2020-10-22 16:51:20 +00:00
|
|
|
setspritepos(actor->GetIndex(), x, y, z); // wrap this for safety. The renderer may need processing of the new position.
|
2020-11-01 09:49:50 +00:00
|
|
|
if (j != s->sectnum && j >= 0 && j < MAXSECTORS)
|
2020-10-22 16:51:20 +00:00
|
|
|
changespritesect(actor, j);
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-10-22 16:51:20 +00:00
|
|
|
S_PlayActorSound(thud, actor);
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-01 09:49:50 +00:00
|
|
|
if (sector[s->sectnum].lotag == 1)
|
2020-11-29 12:54:58 +00:00
|
|
|
s->z += gs.actorinfo[s->picnum].falladjustz;
|
2020-11-01 09:49:50 +00:00
|
|
|
else s->zvel = 0;
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-11 20:54:52 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-01 06:56:49 +00:00
|
|
|
DDukeActor *LocateTheLocator(int n, int sectnum)
|
2020-06-23 19:12:15 +00:00
|
|
|
{
|
2020-11-01 06:56:49 +00:00
|
|
|
DukeStatIterator it(STAT_LOCATOR);
|
|
|
|
while (auto ac = it.Next())
|
2020-06-23 19:12:15 +00:00
|
|
|
{
|
2020-11-01 06:56:49 +00:00
|
|
|
if ((sectnum == -1 || sectnum == ac->s.sectnum) && n == ac->s.lotag)
|
|
|
|
return ac;
|
2020-06-23 19:12:15 +00:00
|
|
|
}
|
2020-11-01 06:56:49 +00:00
|
|
|
return nullptr;
|
2020-06-23 19:12:15 +00:00
|
|
|
}
|
|
|
|
|
2020-09-11 20:54:52 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void recordoldspritepos()
|
|
|
|
{
|
|
|
|
for (int statNum = 0; statNum < MAXSTATUS; statNum++)
|
|
|
|
{
|
2020-10-21 21:56:46 +00:00
|
|
|
DukeStatIterator it(statNum);
|
|
|
|
while (auto ac = it.Next())
|
2020-09-11 20:54:52 +00:00
|
|
|
{
|
2021-01-05 19:20:55 +00:00
|
|
|
ac->s.backuploc();
|
2020-09-11 20:54:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-23 19:12:15 +00:00
|
|
|
|
|
|
|
|
2020-05-05 09:58:39 +00:00
|
|
|
END_DUKE_NS
|