2020-05-07 12:55:04 +00:00
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
/*
|
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
|
Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements)
|
|
|
|
|
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.
|
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
|
This file contains parts of DukeGDX by Alexander Makarov-[M210] (m210-2007@mail.ru)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#include "ns.h"
|
|
|
|
|
#include "global.h"
|
2020-06-29 21:36:06 +00:00
|
|
|
|
#include "serializer.h"
|
2020-10-21 17:14:41 +00:00
|
|
|
|
#include "dukeactor.h"
|
2022-12-06 20:49:04 +00:00
|
|
|
|
#include "texturemanager.h"
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
|
2020-06-29 21:36:06 +00:00
|
|
|
|
|
2020-05-07 12:55:04 +00:00
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
2023-10-02 19:03:59 +00:00
|
|
|
|
void addweapon_d(DDukePlayer *p, int weapon, bool wswitch)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2023-10-02 10:14:55 +00:00
|
|
|
|
if (p->gotweapon[weapon] == 0 )
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2021-05-15 08:23:50 +00:00
|
|
|
|
p->gotweapon[weapon] = true;
|
|
|
|
|
if (weapon == SHRINKER_WEAPON)
|
|
|
|
|
p->gotweapon[GROW_WEAPON] = true;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
}
|
2022-11-12 08:33:33 +00:00
|
|
|
|
if (!wswitch) return;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
|
|
p->random_club_frame = 0;
|
|
|
|
|
|
|
|
|
|
if (p->holster_weapon == 0)
|
|
|
|
|
{
|
|
|
|
|
p->weapon_pos = -1;
|
|
|
|
|
p->last_weapon = p->curr_weapon;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
p->weapon_pos = 10;
|
|
|
|
|
p->holster_weapon = 0;
|
|
|
|
|
p->last_weapon = -1;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-16 11:01:09 +00:00
|
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-07 20:30:19 +00:00
|
|
|
|
p->curr_weapon = weapon;
|
2021-07-17 02:12:12 +00:00
|
|
|
|
p->wantweaponfire = -1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2023-10-02 10:14:55 +00:00
|
|
|
|
const auto pact = p->GetActor();
|
2020-05-07 12:55:04 +00:00
|
|
|
|
switch (weapon)
|
|
|
|
|
{
|
|
|
|
|
case KNEE_WEAPON:
|
|
|
|
|
case TRIPBOMB_WEAPON:
|
|
|
|
|
case HANDREMOTE_WEAPON:
|
2020-05-07 20:30:19 +00:00
|
|
|
|
case HANDBOMB_WEAPON:
|
2020-05-07 12:55:04 +00:00
|
|
|
|
break;
|
2020-05-07 20:30:19 +00:00
|
|
|
|
case SHOTGUN_WEAPON:
|
2023-10-02 10:14:55 +00:00
|
|
|
|
S_PlayActorSound(SHOTGUN_COCK, pact);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
break;
|
2020-05-07 20:30:19 +00:00
|
|
|
|
case PISTOL_WEAPON:
|
2023-10-02 10:14:55 +00:00
|
|
|
|
S_PlayActorSound(INSERT_CLIP, pact);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
break;
|
2020-05-07 20:30:19 +00:00
|
|
|
|
default:
|
2023-10-02 10:14:55 +00:00
|
|
|
|
S_PlayActorSound(SELECT_WEAPON, pact);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
2022-12-28 21:46:13 +00:00
|
|
|
|
int ifsquished(DDukeActor* actor, int p)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
|
|
|
|
if (isRR()) return false; // this function is a no-op in RR's source.
|
|
|
|
|
|
|
|
|
|
bool squishme = false;
|
2022-11-26 13:48:51 +00:00
|
|
|
|
if (actor->isPlayer() && ud.clipping)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
|
auto sectp = actor->sector();
|
2022-09-03 15:43:39 +00:00
|
|
|
|
double floorceildist = sectp->floorz - sectp->ceilingz;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2021-11-06 22:16:23 +00:00
|
|
|
|
if (sectp->lotag != ST_23_SWINGING_DOOR)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
|
if (actor->spr.pal == 1)
|
2022-09-03 15:43:39 +00:00
|
|
|
|
squishme = floorceildist < 32 && (sectp->lotag & 32768) == 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
else
|
2022-09-03 15:43:39 +00:00
|
|
|
|
squishme = floorceildist < 12;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (squishme)
|
|
|
|
|
{
|
2023-10-02 02:51:13 +00:00
|
|
|
|
FTA(QUOTE_SQUISHED, getPlayer(p));
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2020-10-22 17:12:48 +00:00
|
|
|
|
if (badguy(actor))
|
2022-09-03 08:02:25 +00:00
|
|
|
|
actor->vel.X = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2021-12-21 18:13:49 +00:00
|
|
|
|
if (actor->spr.pal == 1)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2022-12-29 08:56:14 +00:00
|
|
|
|
actor->attackertype = DukeShotSparkClass;
|
2022-01-23 23:10:25 +00:00
|
|
|
|
actor->hitextra = 1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
|
int ifhitbyweapon_d(DDukeActor *actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2020-10-21 19:41:14 +00:00
|
|
|
|
auto hitowner = actor->GetHitOwner();
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2022-01-23 23:10:25 +00:00
|
|
|
|
if (actor->hitextra >= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2022-12-16 15:56:47 +00:00
|
|
|
|
auto adef = actor->attackerDefaults();
|
2021-12-21 18:13:49 +00:00
|
|
|
|
if (actor->spr.extra >= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2022-11-26 13:48:51 +00:00
|
|
|
|
if (actor->isPlayer())
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2022-12-16 15:56:47 +00:00
|
|
|
|
if (ud.god && !(adef->flags3 & SFLAG3_LIGHTDAMAGE)) return -1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2023-10-02 10:22:41 +00:00
|
|
|
|
const auto p = getPlayer(actor->PlayerIndex());
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
|
if (hitowner &&
|
2022-11-26 13:48:51 +00:00
|
|
|
|
hitowner->isPlayer() &&
|
2020-05-07 12:55:04 +00:00
|
|
|
|
ud.coop == 1 &&
|
|
|
|
|
ud.ffire == 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
2022-01-23 23:10:25 +00:00
|
|
|
|
actor->spr.extra -= actor->hitextra;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
|
if (hitowner)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2022-12-16 15:56:47 +00:00
|
|
|
|
if (actor->spr.extra <= 0 && !(adef->flags2 & SFLAG2_FREEZEDAMAGE))
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
|
actor->spr.extra = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2023-10-02 10:22:41 +00:00
|
|
|
|
p->wackedbyactor = hitowner;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2023-10-02 10:22:41 +00:00
|
|
|
|
if (hitowner->isPlayer() && p != getPlayer(hitowner->PlayerIndex()))
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2023-10-02 10:22:41 +00:00
|
|
|
|
p->frag_ps = hitowner->PlayerIndex();
|
2020-05-07 12:55:04 +00:00
|
|
|
|
}
|
2023-10-02 10:22:41 +00:00
|
|
|
|
actor->SetHitOwner(actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-16 15:56:47 +00:00
|
|
|
|
if (adef->flags2 & SFLAG2_DOUBLEDMGTHRUST)
|
2020-05-07 20:30:19 +00:00
|
|
|
|
{
|
2023-10-02 10:22:41 +00:00
|
|
|
|
p->vel.XY() += actor->hitang.ToVector() * actor->hitextra * 0.25;
|
2022-01-20 07:31:08 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-10-02 10:22:41 +00:00
|
|
|
|
p->vel.XY() += actor->hitang.ToVector() * actor->hitextra * 0.125;
|
2020-05-07 20:30:19 +00:00
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-01-23 23:10:25 +00:00
|
|
|
|
if (actor->hitextra == 0)
|
2022-12-31 16:16:11 +00:00
|
|
|
|
if (!shrinkersizecheck(actor->attackertype, actor))
|
2020-05-07 12:55:04 +00:00
|
|
|
|
return -1;
|
|
|
|
|
|
2022-12-31 16:16:11 +00:00
|
|
|
|
if (actor->spr.scale.X < actor->FloatVar(NAME_minhitscale))
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2022-12-16 15:56:47 +00:00
|
|
|
|
return -1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-23 23:10:25 +00:00
|
|
|
|
actor->spr.extra -= actor->hitextra;
|
2020-10-21 19:41:14 +00:00
|
|
|
|
auto Owner = actor->GetOwner();
|
2022-12-20 21:25:48 +00:00
|
|
|
|
if (!(actor->flags2 & SFLAG2_IGNOREHITOWNER) && Owner && Owner->spr.statnum < MAXSTATUS)
|
2020-10-21 19:41:14 +00:00
|
|
|
|
actor->SetOwner(hitowner);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-23 23:10:25 +00:00
|
|
|
|
actor->hitextra = -1;
|
2022-12-16 15:56:47 +00:00
|
|
|
|
// makeshift damage type reporting. Needs improvement and generalization later.
|
|
|
|
|
int res = 0;
|
|
|
|
|
if (adef->flags2 & SFLAG2_FREEZEDAMAGE) res |= 1;
|
|
|
|
|
if (adef->flags2 & SFLAG2_EXPLOSIVE) res |= 2;
|
|
|
|
|
return res;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-12-16 15:56:47 +00:00
|
|
|
|
if (ud.multimode < 2
|
|
|
|
|
|| actor->attackertype == nullptr
|
2022-12-29 08:56:14 +00:00
|
|
|
|
|| actor->attackertype != DukeFlamethrowerFlameClass
|
2022-01-23 23:10:25 +00:00
|
|
|
|
|| actor->hitextra >= 0
|
2021-12-21 18:13:49 +00:00
|
|
|
|
|| actor->spr.extra > 0
|
2022-11-26 13:48:51 +00:00
|
|
|
|
|| !actor->isPlayer()
|
2023-10-02 02:51:13 +00:00
|
|
|
|
|| getPlayer(actor->PlayerIndex())->numloogs > 0
|
2020-10-21 19:41:14 +00:00
|
|
|
|
|| hitowner == nullptr)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2022-01-23 23:10:25 +00:00
|
|
|
|
actor->hitextra = -1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
return -1;
|
|
|
|
|
}
|
2020-10-12 19:15:54 +00:00
|
|
|
|
else
|
2020-05-07 12:55:04 +00:00
|
|
|
|
{
|
2023-10-02 10:22:41 +00:00
|
|
|
|
const auto p = getPlayer(actor->PlayerIndex());
|
2021-12-21 18:13:49 +00:00
|
|
|
|
actor->spr.extra = 0;
|
2023-10-02 10:22:41 +00:00
|
|
|
|
p->wackedbyactor = hitowner;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2023-10-02 10:22:41 +00:00
|
|
|
|
if (hitowner->isPlayer() && hitowner != actor)
|
|
|
|
|
p->frag_ps = hitowner->PlayerIndex(); // set the proper player index here - this previously set the sprite index...
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2023-10-02 10:22:41 +00:00
|
|
|
|
actor->SetHitOwner(actor);
|
2022-01-23 23:10:25 +00:00
|
|
|
|
actor->hitextra = -1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2022-12-16 15:56:47 +00:00
|
|
|
|
return 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-10-12 20:00:19 +00:00
|
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
2020-10-12 18:45:08 +00:00
|
|
|
|
//
|
2020-05-07 22:03:51 +00:00
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
void movetransports_d(void)
|
|
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
|
DukeStatIterator iti(STAT_TRANSPORT);
|
|
|
|
|
while (auto act = iti.Next())
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
|
auto Owner = act->GetOwner();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
|
if (Owner == act)
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2020-10-22 19:42:02 +00:00
|
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
|
auto sectp = act->sector();
|
2021-11-06 22:16:23 +00:00
|
|
|
|
int sectlotag = sectp->lotag;
|
2020-10-22 19:42:02 +00:00
|
|
|
|
int onfloorz = act->temp_data[4];
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2022-12-22 08:49:42 +00:00
|
|
|
|
if (act->counter > 0) act->counter--;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2021-11-21 00:04:16 +00:00
|
|
|
|
DukeSectIterator itj(act->sector());
|
2020-10-22 19:42:02 +00:00
|
|
|
|
while (auto act2 = itj.Next())
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
|
switch (act2->spr.statnum)
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
2021-11-09 23:05:42 +00:00
|
|
|
|
case STAT_PLAYER:
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
|
if (act2->GetOwner())
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
2023-10-02 10:23:41 +00:00
|
|
|
|
const auto pnum = act2->PlayerIndex();
|
|
|
|
|
const auto p = getPlayer(pnum);
|
|
|
|
|
p->on_warping_sector = 1;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2023-10-02 10:23:41 +00:00
|
|
|
|
if (p->transporter_hold == 0 && p->jumping_counter == 0)
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
2023-10-02 10:23:41 +00:00
|
|
|
|
if (p->on_ground && sectlotag == ST_0_NO_EFFECT && onfloorz && p->jetpack_on == 0)
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
|
if (act->spr.pal == 0)
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
2022-12-29 08:56:14 +00:00
|
|
|
|
spawn(act, DukeTransporterBeamClass);
|
2020-10-22 19:42:02 +00:00
|
|
|
|
S_PlayActorSound(TELEPORTER, act);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2023-10-02 10:23:41 +00:00
|
|
|
|
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
2023-10-02 10:23:41 +00:00
|
|
|
|
const auto k = getPlayer(i);
|
|
|
|
|
|
|
|
|
|
if (k->cursector == Owner->sector())
|
|
|
|
|
{
|
|
|
|
|
k->frag_ps = pnum;
|
|
|
|
|
k->GetActor()->spr.extra = 0;
|
|
|
|
|
}
|
2020-10-12 18:45:08 +00:00
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2023-10-02 10:23:41 +00:00
|
|
|
|
act2->PrevAngles.Yaw = act2->spr.Angles.Yaw = Owner->spr.Angles.Yaw;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
|
if (Owner->GetOwner() != Owner)
|
2020-10-12 18:45:08 +00:00
|
|
|
|
{
|
2022-12-22 08:49:42 +00:00
|
|
|
|
act->counter = 13;
|
|
|
|
|
Owner->counter = 13;
|
2023-10-02 10:23:41 +00:00
|
|
|
|
p->transporter_hold = 13;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2023-10-02 10:23:41 +00:00
|
|
|
|
act2->spr.pos = Owner->spr.pos;
|
|
|
|
|
act2->backuppos();
|
|
|
|
|
p->setbobpos();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2021-11-26 20:52:01 +00:00
|
|
|
|
ChangeActorSect(act2, Owner->sector());
|
2023-10-02 10:23:41 +00:00
|
|
|
|
p->setCursector(act2->sector());
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
|
if (act->spr.pal == 0)
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
2023-01-01 15:08:12 +00:00
|
|
|
|
auto beam = spawn(Owner, DukeTransporterBeamClass);
|
|
|
|
|
if (beam) S_PlayActorSound(TELEPORTER, beam);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-02 10:23:41 +00:00
|
|
|
|
else if (!(sectlotag == ST_1_ABOVE_WATER && p->on_ground == 1)) break;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2023-10-02 10:23:41 +00:00
|
|
|
|
if (onfloorz == 0 && fabs(act->spr.pos.Z - act2->getOffsetZ()) < 24)
|
|
|
|
|
{
|
2023-10-03 08:22:42 +00:00
|
|
|
|
if ((p->jetpack_on == 0) || (p->jetpack_on && (!!(p->cmd.ucmd.actions & SB_JUMP) || p->cmd.ucmd.vel.Z > 0)) ||
|
|
|
|
|
(p->jetpack_on && (!!(p->cmd.ucmd.actions & SB_CROUCH) || p->cmd.ucmd.vel.Z < 0)))
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
2023-10-02 10:23:41 +00:00
|
|
|
|
act2->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
|
|
|
|
act2->backupvec2();
|
2022-10-08 03:38:21 +00:00
|
|
|
|
|
2023-10-03 08:22:42 +00:00
|
|
|
|
if (p->jetpack_on && (!!(p->cmd.ucmd.actions & SB_JUMP) || p->jetpack_on < 11))
|
2023-10-02 10:23:41 +00:00
|
|
|
|
act2->spr.pos.Z = Owner->spr.pos.Z - 24 + gs.playerheight;
|
|
|
|
|
else act2->spr.pos.Z = Owner->spr.pos.Z + 24 + gs.playerheight;
|
|
|
|
|
act2->backuppos();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2021-11-26 20:52:01 +00:00
|
|
|
|
ChangeActorSect(act2, Owner->sector());
|
2023-10-02 10:23:41 +00:00
|
|
|
|
p->setCursector(Owner->sector());
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2023-10-02 10:23:41 +00:00
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-10-12 19:15:54 +00:00
|
|
|
|
int k = 0;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2022-12-30 15:35:54 +00:00
|
|
|
|
if (ud.mapflags & MFLAG_ALLSECTORTYPES)
|
|
|
|
|
{
|
2023-10-02 10:23:41 +00:00
|
|
|
|
if (onfloorz && sectlotag == ST_160_FLOOR_TELEPORT && act2->getOffsetZ() > sectp->floorz - 48)
|
2022-12-30 15:35:54 +00:00
|
|
|
|
{
|
|
|
|
|
k = 2;
|
2023-10-02 10:23:41 +00:00
|
|
|
|
act2->spr.pos.Z = Owner->sector()->ceilingz + 7 + gs.playerheight;
|
|
|
|
|
act2->backupz();
|
2022-12-30 15:35:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-10-02 10:23:41 +00:00
|
|
|
|
if (onfloorz && sectlotag == ST_161_CEILING_TELEPORT && act2->getOffsetZ() < sectp->ceilingz + 6)
|
2022-12-30 15:35:54 +00:00
|
|
|
|
{
|
|
|
|
|
k = 2;
|
2023-10-02 10:23:41 +00:00
|
|
|
|
if (act2->spr.extra <= 0) break;
|
|
|
|
|
act2->spr.pos.Z = Owner->sector()->floorz - 49 + gs.playerheight;
|
|
|
|
|
act2->backupz();
|
2022-12-30 15:35:54 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-10-03 08:22:42 +00:00
|
|
|
|
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && p->on_ground && act2->getOffsetZ() > (sectp->floorz - 16) && (!!(p->cmd.ucmd.actions & SB_CROUCH) || p->cmd.ucmd.vel.Z < 0 || p->vel.Z > 8))
|
2021-11-09 23:05:42 +00:00
|
|
|
|
// if( onfloorz && sectlotag == 1 && ps[p].pos.z > (sectp->floorz-(6<<8)) )
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
|
|
|
|
k = 1;
|
2023-10-02 10:23:41 +00:00
|
|
|
|
if (getPlayer(screenpeek) == p)
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
|
|
|
|
FX_StopAllSounds();
|
|
|
|
|
}
|
2023-10-02 10:23:41 +00:00
|
|
|
|
if (act2->spr.extra > 0)
|
2020-10-22 19:42:02 +00:00
|
|
|
|
S_PlayActorSound(DUKE_UNDERWATER, act2);
|
2023-10-02 10:23:41 +00:00
|
|
|
|
act2->spr.pos.Z = Owner->sector()->ceilingz + 7 + gs.playerheight;
|
|
|
|
|
act2->backupz();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2022-09-11 22:14:31 +00:00
|
|
|
|
// this is actually below the precision <20>f the original Build coordinate system...
|
2023-10-02 10:23:41 +00:00
|
|
|
|
p->vel.X = ((krand() & 8192) ? 1 / 64. : -1 / 64.);
|
|
|
|
|
p->vel.Y = ((krand() & 8192) ? 1 / 64. : -1 / 64.);
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2023-10-02 10:23:41 +00:00
|
|
|
|
if (onfloorz && sectlotag == ST_2_UNDERWATER && act2->getOffsetZ() < (sectp->ceilingz + 6))
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
|
|
|
|
k = 1;
|
2021-12-21 18:45:48 +00:00
|
|
|
|
// if( act2->spr.extra <= 0) break;
|
2023-10-02 10:23:41 +00:00
|
|
|
|
if (getPlayer(screenpeek) == p)
|
2020-05-07 22:03:51 +00:00
|
|
|
|
{
|
|
|
|
|
FX_StopAllSounds();
|
|
|
|
|
}
|
2020-10-22 19:42:02 +00:00
|
|
|
|
S_PlayActorSound(DUKE_GASP, act2);
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2023-10-02 10:23:41 +00:00
|
|
|
|
act2->spr.pos.Z = Owner->sector()->floorz - 7 + gs.playerheight;
|
|
|
|
|
act2->backupz();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2023-10-02 10:23:41 +00:00
|
|
|
|
p->jumping_toggle = 1;
|
|
|
|
|
p->jumping_counter = 0;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
|
if (k == 1)
|
|
|
|
|
{
|
2023-10-02 10:23:41 +00:00
|
|
|
|
act2->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
|
|
|
|
act2->backupvec2();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
|
if (!Owner || Owner->GetOwner() != Owner)
|
2023-10-02 10:23:41 +00:00
|
|
|
|
p->transporter_hold = -2;
|
2021-11-21 07:45:07 +00:00
|
|
|
|
|
2023-10-02 10:23:41 +00:00
|
|
|
|
p->setCursector(Owner->sector());
|
2021-11-26 20:52:01 +00:00
|
|
|
|
ChangeActorSect(act2, Owner->sector());
|
2022-11-21 04:08:33 +00:00
|
|
|
|
SetActor(act2, act2->spr.pos);
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
|
if ((krand() & 255) < 32)
|
2022-12-29 08:56:14 +00:00
|
|
|
|
spawn(act2, DukeWaterSplashClass);
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2023-01-01 15:08:12 +00:00
|
|
|
|
if (sectlotag == ST_1_ABOVE_WATER)
|
2020-10-12 19:15:54 +00:00
|
|
|
|
for (int l = 0; l < 9; l++)
|
2020-10-12 18:45:08 +00:00
|
|
|
|
{
|
2023-10-02 10:23:41 +00:00
|
|
|
|
auto q = spawn(act2, DukeWaterBubbleClass);
|
2022-09-12 16:37:35 +00:00
|
|
|
|
if (q) q->spr.pos.Z += krandf(64);
|
2020-10-12 18:45:08 +00:00
|
|
|
|
}
|
2020-05-07 22:03:51 +00:00
|
|
|
|
}
|
2022-12-30 15:35:54 +00:00
|
|
|
|
else if (k == 2)
|
|
|
|
|
{
|
2023-10-02 10:23:41 +00:00
|
|
|
|
act2->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
|
|
|
|
act2->backupvec2();
|
2022-12-30 15:35:54 +00:00
|
|
|
|
|
|
|
|
|
if (Owner->GetOwner() != Owner)
|
2023-10-02 10:23:41 +00:00
|
|
|
|
p->transporter_hold = -2;
|
2022-12-30 15:35:54 +00:00
|
|
|
|
|
2023-10-02 10:23:41 +00:00
|
|
|
|
p->setCursector(Owner->sector());
|
2022-12-30 15:35:54 +00:00
|
|
|
|
ChangeActorSect(act2, Owner->sector());
|
|
|
|
|
}
|
2020-05-07 22:03:51 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
|
case STAT_ACTOR:
|
2022-12-30 15:21:09 +00:00
|
|
|
|
if ((act2->flags3 & SFLAG3_DONTDIVEALIVE) && act2->spr.extra > 0) continue;
|
2021-11-14 11:25:25 +00:00
|
|
|
|
[[fallthrough]];
|
2020-05-07 22:03:51 +00:00
|
|
|
|
case STAT_PROJECTILE:
|
|
|
|
|
case STAT_MISC:
|
|
|
|
|
case STAT_FALLER:
|
|
|
|
|
case STAT_DUMMYPLAYER:
|
2022-12-30 15:21:09 +00:00
|
|
|
|
if ((act2->flags2 & SFLAG2_DONTDIVE)) continue;
|
|
|
|
|
checkdive(act, act2);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
break;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
2020-05-08 22:34:48 +00:00
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
2020-10-22 20:55:53 +00:00
|
|
|
|
void handle_se06_d(DDukeActor* actor)
|
|
|
|
|
{
|
2021-11-20 23:33:17 +00:00
|
|
|
|
auto sc = actor->sector();
|
2021-12-21 18:45:48 +00:00
|
|
|
|
int sh = actor->spr.hitag;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
|
|
|
|
|
int k = sc->extra;
|
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
|
if (actor->temp_data[4] > 0)
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
|
actor->temp_data[4]--;
|
|
|
|
|
if (actor->temp_data[4] >= (k - (k >> 3)))
|
2022-09-11 19:01:38 +00:00
|
|
|
|
actor->vel.X -= (k >> 5) / 16.;
|
2021-12-23 15:20:32 +00:00
|
|
|
|
if (actor->temp_data[4] > ((k >> 1) - 1) && actor->temp_data[4] < (k - (k >> 3)))
|
2022-09-03 08:02:25 +00:00
|
|
|
|
actor->vel.X = 0;
|
2021-12-23 15:20:32 +00:00
|
|
|
|
if (actor->temp_data[4] < (k >> 1))
|
2022-09-11 19:01:38 +00:00
|
|
|
|
actor->vel.X += (k >> 5) / 16.;
|
2021-12-23 15:20:32 +00:00
|
|
|
|
if (actor->temp_data[4] < ((k >> 1) - (k >> 3)))
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
|
actor->temp_data[4] = 0;
|
2022-09-11 19:01:38 +00:00
|
|
|
|
actor->vel.X = k / 16.;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-09-11 19:01:38 +00:00
|
|
|
|
else actor->vel.X = k / 16.;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
|
|
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
|
while (auto act2 = it.Next())
|
|
|
|
|
{
|
2022-12-22 08:49:42 +00:00
|
|
|
|
if ((act2->spr.lotag == SE_14_SUBWAY_CAR) && (sh == act2->spr.hitag) && (act2->counter == actor->counter))
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2022-09-11 18:46:21 +00:00
|
|
|
|
act2->vel.X = actor->vel.X;
|
2021-12-23 15:20:32 +00:00
|
|
|
|
//if( actor->temp_data[4] == 1 )
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2022-09-11 19:01:38 +00:00
|
|
|
|
if (act2->temp_pos.X == 0)
|
|
|
|
|
act2->temp_pos.X = (act2->spr.pos - actor->spr.pos).LengthSquared();
|
|
|
|
|
int x = Sgn((act2->spr.pos - actor->spr.pos).LengthSquared() - act2->temp_pos.X);
|
2021-12-21 17:19:45 +00:00
|
|
|
|
if (act2->spr.extra)
|
2020-10-22 20:55:53 +00:00
|
|
|
|
x = -x;
|
2022-09-11 18:46:21 +00:00
|
|
|
|
actor->vel.X += x / 16.;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
}
|
2021-12-23 15:20:32 +00:00
|
|
|
|
act2->temp_data[4] = actor->temp_data[4];
|
2020-10-22 20:55:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-29 08:56:14 +00:00
|
|
|
|
handle_se14(actor, true, DukeRPGClass);
|
2020-10-22 20:55:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
static void handle_se28(DDukeActor* actor)
|
|
|
|
|
{
|
2022-12-22 08:49:42 +00:00
|
|
|
|
if (actor->temp_data[0] > 0)
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2022-12-22 08:49:42 +00:00
|
|
|
|
actor->temp_data[0]--;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-22 08:49:42 +00:00
|
|
|
|
if (actor->counter == 0)
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2022-09-14 20:49:01 +00:00
|
|
|
|
double x;
|
2021-11-14 14:03:50 +00:00
|
|
|
|
findplayer(actor, &x);
|
2022-09-14 20:49:01 +00:00
|
|
|
|
if (x > 15500 / 16.)
|
2020-10-22 20:55:53 +00:00
|
|
|
|
return;
|
2022-12-22 08:49:42 +00:00
|
|
|
|
actor->counter = 1;
|
2021-12-23 15:20:32 +00:00
|
|
|
|
actor->temp_data[1] = 64 + (krand() & 511);
|
|
|
|
|
actor->temp_data[2] = 0;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-10-02 10:06:14 +00:00
|
|
|
|
const auto spp = getPlayer(screenpeek);
|
2021-12-23 15:20:32 +00:00
|
|
|
|
actor->temp_data[2]++;
|
2023-10-02 10:06:14 +00:00
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
|
if (actor->temp_data[2] > actor->temp_data[1])
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2022-12-22 08:49:42 +00:00
|
|
|
|
actor->counter = 0;
|
2023-10-02 10:06:14 +00:00
|
|
|
|
spp->visibility = ud.const_visibility;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2021-12-23 15:20:32 +00:00
|
|
|
|
else if (actor->temp_data[2] == (actor->temp_data[1] >> 1))
|
2020-10-22 20:55:53 +00:00
|
|
|
|
S_PlayActorSound(THUNDER, actor);
|
2021-12-23 15:20:32 +00:00
|
|
|
|
else if (actor->temp_data[2] == (actor->temp_data[1] >> 3))
|
2020-10-22 20:55:53 +00:00
|
|
|
|
S_PlayActorSound(LIGHTNING_SLAP, actor);
|
2021-12-23 15:20:32 +00:00
|
|
|
|
else if (actor->temp_data[2] == (actor->temp_data[1] >> 2))
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
|
|
|
|
DukeStatIterator it(STAT_DEFAULT);
|
|
|
|
|
while (auto act2 = it.Next())
|
|
|
|
|
{
|
2022-12-29 08:56:14 +00:00
|
|
|
|
if (act2->GetClass() == DukeNaturalLightningClass && act2->spr.hitag == actor->spr.hitag)
|
2021-12-21 17:19:45 +00:00
|
|
|
|
act2->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-23 15:20:32 +00:00
|
|
|
|
else if (actor->temp_data[2] > (actor->temp_data[1] >> 3) && actor->temp_data[2] < (actor->temp_data[1] >> 2))
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2023-10-02 10:06:14 +00:00
|
|
|
|
int j = !!cansee(actor->spr.pos, actor->sector(), spp->GetActor()->getPosWithOffsetZ(), spp->cursector);
|
2020-10-22 20:55:53 +00:00
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
|
if (rnd(192) && (actor->temp_data[2] & 1))
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2023-10-02 10:06:14 +00:00
|
|
|
|
if (j) spp->visibility = 0;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
}
|
2023-10-02 10:06:14 +00:00
|
|
|
|
else if (j) spp->visibility = ud.const_visibility;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
|
|
|
|
|
DukeStatIterator it(STAT_DEFAULT);
|
|
|
|
|
while (auto act2 = it.Next())
|
|
|
|
|
{
|
2022-12-29 08:56:14 +00:00
|
|
|
|
if (act2->GetClass() == DukeNaturalLightningClass && act2->spr.hitag == actor->spr.hitag)
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
|
if (rnd(32) && (actor->temp_data[2] & 1))
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
|
act2->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
2022-12-29 08:56:14 +00:00
|
|
|
|
spawn(act2, DukeSmallSmokeClass);
|
2020-10-22 20:55:53 +00:00
|
|
|
|
|
2022-09-13 21:29:41 +00:00
|
|
|
|
double x;
|
2023-10-02 10:06:14 +00:00
|
|
|
|
const auto p = getPlayer(findplayer(actor, &x));
|
|
|
|
|
const auto pact = p->GetActor();
|
|
|
|
|
double dist = (pact->spr.pos.XY() - act2->spr.pos.XY()).LengthSquared();
|
|
|
|
|
|
2023-10-02 10:08:54 +00:00
|
|
|
|
if (dist < 48*48)
|
2020-10-22 20:55:53 +00:00
|
|
|
|
{
|
2023-10-02 10:06:14 +00:00
|
|
|
|
if (S_CheckActorSoundPlaying(pact, DUKE_LONGTERM_PAIN) < 1)
|
|
|
|
|
S_PlayActorSound(DUKE_LONGTERM_PAIN, pact);
|
|
|
|
|
S_PlayActorSound(SHORT_CIRCUIT, pact);
|
|
|
|
|
pact->spr.extra -= 8 + (krand() & 7);
|
|
|
|
|
SetPlayerPal(p, PalEntry(32, 16, 0, 0));
|
2020-10-22 20:55:53 +00:00
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-12-21 17:19:45 +00:00
|
|
|
|
else act2->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
|
void moveeffectors_d(void) //STATNUM 3
|
|
|
|
|
{
|
|
|
|
|
clearfriction();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-10-22 21:17:51 +00:00
|
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
|
while (auto act = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
|
{
|
2021-11-20 23:33:17 +00:00
|
|
|
|
auto sc = act->sector();
|
2021-12-21 17:19:45 +00:00
|
|
|
|
switch (act->spr.lotag)
|
2020-05-10 07:08:02 +00:00
|
|
|
|
{
|
|
|
|
|
case SE_0_ROTATING_SECTOR:
|
2022-01-19 09:48:18 +00:00
|
|
|
|
handle_se00(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
|
case SE_1_PIVOT: //Nothing for now used as the pivot
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se01(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
|
case SE_6_SUBWAY:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se06_d(act);
|
2020-10-22 20:55:53 +00:00
|
|
|
|
break;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
|
|
case SE_14_SUBWAY_CAR:
|
2022-12-29 08:56:14 +00:00
|
|
|
|
handle_se14(act, true, DukeRPGClass);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_30_TWO_WAY_TRAIN:
|
2022-12-28 23:51:26 +00:00
|
|
|
|
handle_se30(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_2_EARTHQUAKE:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se02(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2022-12-29 23:47:09 +00:00
|
|
|
|
//Flashing sector lights after reactor explosion
|
2020-05-10 07:08:02 +00:00
|
|
|
|
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se03(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_4_RANDOM_LIGHTS:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se04(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
//BOSS
|
|
|
|
|
case SE_5_BOSS:
|
2022-11-29 14:12:35 +00:00
|
|
|
|
handle_se05(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_8_UP_OPEN_DOOR_LIGHTS:
|
|
|
|
|
case SE_9_DOWN_OPEN_DOOR_LIGHTS:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se08(act, false);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_10_DOOR_AUTO_CLOSE:
|
|
|
|
|
{
|
|
|
|
|
static const int tags[] = { 20, 21, 22, 26, 0};
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se10(act, tags);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case SE_11_SWINGING_DOOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se11(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
|
case SE_12_LIGHT_SWITCH:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se12(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_13_EXPLOSIVE:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se13(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_15_SLIDING_DOOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se15(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_16_REACTOR:
|
2022-12-02 22:26:55 +00:00
|
|
|
|
handle_se16(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_17_WARP_ELEVATOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se17(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se18(act, true);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_19_EXPLOSION_LOWERS_CEILING:
|
2022-12-09 23:56:40 +00:00
|
|
|
|
handle_se19(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_20_STRETCH_BRIDGE:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se20(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_21_DROP_FLOOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se21(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_22_TEETH_DOOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se22(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_24_CONVEYOR:
|
2020-11-27 19:06:38 +00:00
|
|
|
|
case SE_34:
|
2020-10-14 18:49:43 +00:00
|
|
|
|
{
|
2022-09-12 19:59:34 +00:00
|
|
|
|
handle_se24(act, true, 0.25);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
2020-10-14 18:49:43 +00:00
|
|
|
|
}
|
2020-11-27 19:06:38 +00:00
|
|
|
|
case SE_35:
|
2022-12-12 18:39:17 +00:00
|
|
|
|
handle_se35(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
|
case SE_25_PISTON: //PISTONS
|
2020-10-22 21:17:51 +00:00
|
|
|
|
if (act->temp_data[4] == 0) break;
|
2022-09-12 21:35:48 +00:00
|
|
|
|
handle_se25(act, -1, -1);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
|
case SE_26:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se26(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SE_27_DEMO_CAM:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se27(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
2020-11-27 19:06:38 +00:00
|
|
|
|
case SE_28_LIGHTNING:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se28(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
|
case SE_29_WAVES:
|
2022-09-11 21:51:48 +00:00
|
|
|
|
handle_se29(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
2022-09-11 21:51:48 +00:00
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
|
case SE_31_FLOOR_RISE_FALL: // True Drop Floor
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se31(act, true);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
|
case SE_32_CEILING_RISE_FALL: // True Drop Ceiling
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se32(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
|
case SE_33_QUAKE_DEBRIS:
|
2022-11-30 16:15:44 +00:00
|
|
|
|
if (ud.earthquaketime > 0 && (krand() & 7) == 0)
|
2020-10-22 21:17:51 +00:00
|
|
|
|
RANDOMSCRAP(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
2020-11-27 19:06:38 +00:00
|
|
|
|
case SE_36_PROJ_SHOOTER:
|
2022-12-29 09:56:10 +00:00
|
|
|
|
handle_se36(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2021-11-15 22:32:41 +00:00
|
|
|
|
case SE_128_GLASS_BREAKING:
|
2020-10-22 21:17:51 +00:00
|
|
|
|
handle_se128(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 130:
|
2022-12-12 18:39:17 +00:00
|
|
|
|
handle_se130(act, 80);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
case 131:
|
2022-12-12 18:39:17 +00:00
|
|
|
|
handle_se130(act, 40);
|
2020-05-10 07:08:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Sloped sin-wave floors!
|
2020-10-14 18:02:05 +00:00
|
|
|
|
it.Reset(STAT_EFFECTOR);
|
2020-10-22 21:17:51 +00:00
|
|
|
|
while (auto act = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
|
if (act->spr.lotag != SE_29_WAVES) continue;
|
2021-11-20 23:33:17 +00:00
|
|
|
|
auto sc = act->sector();
|
2022-11-15 13:59:28 +00:00
|
|
|
|
if (sc->walls.Size() != 4) continue;
|
2022-11-15 14:33:35 +00:00
|
|
|
|
auto wal = &sc->walls[2];
|
2022-09-12 19:26:17 +00:00
|
|
|
|
if (wal->nextSector()) alignflorslope(act->sector(), DVector3(wal->pos, wal->nextSector()->floorz));
|
2020-05-10 07:08:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
2020-10-22 21:41:07 +00:00
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
2020-06-23 19:12:15 +00:00
|
|
|
|
void think_d(void)
|
|
|
|
|
{
|
|
|
|
|
thinktime.Reset();
|
|
|
|
|
thinktime.Clock();
|
|
|
|
|
|
2022-01-02 14:44:52 +00:00
|
|
|
|
movefta(); //ST 2
|
2022-12-03 16:24:41 +00:00
|
|
|
|
tickstat(STAT_PROJECTILE); //ST 4
|
2020-06-23 19:12:15 +00:00
|
|
|
|
moveplayers(); //ST 10
|
2022-12-14 16:12:36 +00:00
|
|
|
|
movefallers(); //ST 12
|
2022-12-12 00:14:45 +00:00
|
|
|
|
tickstat(STAT_MISC, true); //ST 5
|
2020-06-23 19:12:15 +00:00
|
|
|
|
|
|
|
|
|
actortime.Reset();
|
|
|
|
|
actortime.Clock();
|
2023-03-18 11:08:53 +00:00
|
|
|
|
tickstat(STAT_ACTOR, true); //ST 1
|
2020-06-23 19:12:15 +00:00
|
|
|
|
actortime.Unclock();
|
|
|
|
|
|
|
|
|
|
moveeffectors_d(); //ST 3
|
2022-12-03 16:24:41 +00:00
|
|
|
|
tickstat(STAT_STANDABLE); //ST 6
|
2020-06-23 19:12:15 +00:00
|
|
|
|
doanimations();
|
2022-11-20 21:07:10 +00:00
|
|
|
|
tickstat(STAT_FX); //ST 11
|
2020-06-23 19:12:15 +00:00
|
|
|
|
|
2022-12-08 23:44:48 +00:00
|
|
|
|
if (numplayers < 2 && thunderon)
|
|
|
|
|
thunder();
|
|
|
|
|
|
2020-06-23 19:12:15 +00:00
|
|
|
|
thinktime.Unclock();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-05-07 12:55:04 +00:00
|
|
|
|
END_DUKE_NS
|