2020-05-10 10:42:47 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2017-2019 Nuke.YKT
|
2020-05-13 14:19:39 +00:00
|
|
|
Copyright (C) 2020 - Christoph Oelckers
|
2020-05-10 10:42:47 +00:00
|
|
|
|
|
|
|
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
|
|
|
|
|
|
|
Duke Nukem 3D is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Original Source: 1996 - Todd Replogle
|
|
|
|
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-10 10:42:47 +00:00
|
|
|
#include "ns.h"
|
|
|
|
#include "global.h"
|
2020-06-24 19:21:02 +00:00
|
|
|
#include "sounds.h"
|
2020-07-03 21:56:14 +00:00
|
|
|
#include "names_r.h"
|
2020-07-07 15:56:20 +00:00
|
|
|
#include "mapinfo.h"
|
2020-10-21 17:14:41 +00:00
|
|
|
#include "dukeactor.h"
|
2020-12-01 11:52:49 +00:00
|
|
|
#include "secrets.h"
|
2022-12-04 08:18:57 +00:00
|
|
|
#include "vm.h"
|
2020-05-10 10:42:47 +00:00
|
|
|
|
|
|
|
// PRIMITIVE
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-10 14:53:09 +00:00
|
|
|
void animatewalls_r(void)
|
|
|
|
{
|
2021-11-17 22:06:28 +00:00
|
|
|
int t;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
|
|
|
if (isRRRA() &&ps[screenpeek].sea_sick_stat == 1)
|
|
|
|
{
|
2021-12-21 08:23:39 +00:00
|
|
|
for (auto& wal : wall)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-17 22:06:28 +00:00
|
|
|
if (wal.picnum == RRTILE7873)
|
|
|
|
wal.addxpan(6);
|
|
|
|
else if (wal.picnum == RRTILE7870)
|
|
|
|
wal.addxpan(6);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-17 22:06:28 +00:00
|
|
|
for (int p = 0; p < numanimwalls; p++)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-17 23:30:37 +00:00
|
|
|
auto wal = animwall[p].wall;
|
2021-11-17 22:06:28 +00:00
|
|
|
int j = wal->picnum;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
|
|
|
switch (j)
|
|
|
|
{
|
|
|
|
case SCREENBREAK1:
|
|
|
|
case SCREENBREAK2:
|
|
|
|
case SCREENBREAK3:
|
|
|
|
case SCREENBREAK4:
|
|
|
|
case SCREENBREAK5:
|
|
|
|
|
|
|
|
case SCREENBREAK9:
|
|
|
|
case SCREENBREAK10:
|
|
|
|
case SCREENBREAK11:
|
|
|
|
case SCREENBREAK12:
|
|
|
|
case SCREENBREAK13:
|
|
|
|
|
|
|
|
if ((krand() & 255) < 16)
|
|
|
|
{
|
2021-11-17 22:06:28 +00:00
|
|
|
animwall[p].tag = wal->picnum;
|
|
|
|
wal->picnum = SCREENBREAK6;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case SCREENBREAK6:
|
|
|
|
case SCREENBREAK7:
|
|
|
|
case SCREENBREAK8:
|
|
|
|
|
|
|
|
if (animwall[p].tag >= 0)
|
2021-11-17 22:06:28 +00:00
|
|
|
wal->picnum = animwall[p].tag;
|
2020-05-12 11:43:24 +00:00
|
|
|
else
|
|
|
|
{
|
2021-11-17 22:06:28 +00:00
|
|
|
wal->picnum++;
|
|
|
|
if (wal->picnum == (SCREENBREAK6 + 3))
|
|
|
|
wal->picnum = SCREENBREAK6;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-12-18 14:11:21 +00:00
|
|
|
if (wal->cstat & CSTAT_WALL_MASKED)
|
2021-11-17 22:06:28 +00:00
|
|
|
switch (wal->overpicnum)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
case W_FORCEFIELD:
|
|
|
|
case W_FORCEFIELD + 1:
|
|
|
|
case W_FORCEFIELD + 2:
|
|
|
|
|
|
|
|
t = animwall[p].tag;
|
|
|
|
|
2021-12-18 14:11:21 +00:00
|
|
|
if (wal->cstat & CSTAT_WALL_ANY_EXCEPT_BLOCK)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-09-15 16:12:09 +00:00
|
|
|
wal->addxpan(-t / 4096.f);
|
|
|
|
wal->addypan(-t / 4096.f);
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-17 22:06:28 +00:00
|
|
|
if (wal->extra == 1)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-17 22:06:28 +00:00
|
|
|
wal->extra = 0;
|
2020-05-12 11:43:24 +00:00
|
|
|
animwall[p].tag = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
animwall[p].tag += 128;
|
|
|
|
|
|
|
|
if (animwall[p].tag < (128 << 4))
|
|
|
|
{
|
|
|
|
if (animwall[p].tag & 128)
|
2021-11-17 22:06:28 +00:00
|
|
|
wal->overpicnum = W_FORCEFIELD;
|
|
|
|
else wal->overpicnum = W_FORCEFIELD + 1;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((krand() & 255) < 32)
|
|
|
|
animwall[p].tag = 128 << (krand() & 3);
|
2021-11-17 22:06:28 +00:00
|
|
|
else wal->overpicnum = W_FORCEFIELD + 1;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-05-10 14:53:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-02 18:53:04 +00:00
|
|
|
void operateforcefields_r(DDukeActor* act, int low)
|
2020-05-10 16:05:36 +00:00
|
|
|
{
|
2020-11-02 18:53:04 +00:00
|
|
|
operateforcefields_common(act, low, { BIGFORCE });
|
2020-05-10 16:05:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-17 23:16:53 +00:00
|
|
|
bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
|
2020-05-10 16:05:36 +00:00
|
|
|
{
|
2020-08-11 22:31:04 +00:00
|
|
|
uint8_t switchpal;
|
2021-11-17 22:10:25 +00:00
|
|
|
int lotag, hitag, picnum, correctdips, numdips;
|
2022-09-13 17:48:44 +00:00
|
|
|
DVector2 pos;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-17 23:16:53 +00:00
|
|
|
if (wwal == nullptr && act == nullptr) return 0;
|
2020-05-12 11:43:24 +00:00
|
|
|
correctdips = 1;
|
|
|
|
numdips = 0;
|
|
|
|
|
2020-10-26 06:30:34 +00:00
|
|
|
if (act)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
lotag = act->spr.lotag;
|
2020-10-26 05:55:16 +00:00
|
|
|
if (lotag == 0) return 0;
|
2021-12-21 17:19:45 +00:00
|
|
|
hitag = act->spr.hitag;
|
2022-09-13 17:48:44 +00:00
|
|
|
pos = act->spr.pos.XY();
|
2021-12-21 17:19:45 +00:00
|
|
|
picnum = act->spr.picnum;
|
|
|
|
switchpal = act->spr.pal;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-17 22:10:25 +00:00
|
|
|
lotag = wwal->lotag;
|
2020-10-26 05:55:16 +00:00
|
|
|
if (lotag == 0) return 0;
|
2021-11-17 22:10:25 +00:00
|
|
|
hitag = wwal->hitag;
|
2022-09-13 17:48:44 +00:00
|
|
|
pos = wwal->pos;
|
2021-11-17 22:10:25 +00:00
|
|
|
picnum = wwal->picnum;
|
|
|
|
switchpal = wwal->pal;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (picnum)
|
|
|
|
{
|
|
|
|
case DIPSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case DIPSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case TECHSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case TECHSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case ALIENSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case ALIENSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case ACCESSSWITCH:
|
|
|
|
case ACCESSSWITCH2:
|
|
|
|
if (ps[snum].access_incs == 0)
|
|
|
|
{
|
|
|
|
if (switchpal == 0)
|
|
|
|
{
|
|
|
|
if (ps[snum].keys[1])
|
|
|
|
ps[snum].access_incs = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FTA(70, &ps[snum]);
|
2020-10-26 06:30:34 +00:00
|
|
|
if (isRRRA()) S_PlayActorSound(99, act? act : ps[snum].GetActor());
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (switchpal == 21)
|
|
|
|
{
|
|
|
|
if (ps[snum].keys[2])
|
|
|
|
ps[snum].access_incs = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FTA(71, &ps[snum]);
|
2020-10-26 06:30:34 +00:00
|
|
|
if (isRRRA()) S_PlayActorSound(99, act ? act : ps[snum].GetActor());
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (switchpal == 23)
|
|
|
|
{
|
|
|
|
if (ps[snum].keys[3])
|
|
|
|
ps[snum].access_incs = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FTA(72, &ps[snum]);
|
2020-10-26 06:30:34 +00:00
|
|
|
if (isRRRA()) S_PlayActorSound(99, act ? act : ps[snum].GetActor());
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps[snum].access_incs == 1)
|
|
|
|
{
|
2020-10-26 06:30:34 +00:00
|
|
|
if (!act)
|
2021-11-17 23:20:39 +00:00
|
|
|
ps[snum].access_wall = wwal;
|
2020-05-12 11:43:24 +00:00
|
|
|
else
|
2020-10-25 05:34:25 +00:00
|
|
|
ps[snum].access_spritenum = act;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2020-08-11 22:31:04 +00:00
|
|
|
goto goOn1;
|
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
case MULTISWITCH2:
|
2022-11-25 09:03:15 +00:00
|
|
|
case MULTISWITCH2_2:
|
|
|
|
case MULTISWITCH2_3:
|
|
|
|
case MULTISWITCH2_4:
|
|
|
|
case IRONWHEELSWITCH:
|
2020-05-12 11:43:24 +00:00
|
|
|
case RRTILE8660:
|
2020-08-11 22:31:04 +00:00
|
|
|
if (!isRRRA()) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-12 11:43:24 +00:00
|
|
|
case DIPSWITCH2:
|
2022-11-25 09:03:15 +00:00
|
|
|
case DIPSWITCH2ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case DIPSWITCH3:
|
2022-11-25 09:03:15 +00:00
|
|
|
case DIPSWITCH3ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case MULTISWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case MULTISWITCH_2:
|
|
|
|
case MULTISWITCH_3:
|
|
|
|
case MULTISWITCH_4:
|
2020-05-12 11:43:24 +00:00
|
|
|
case PULLSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case PULLSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case HANDSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case HANDSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case SLOTDOOR:
|
2022-11-25 09:03:15 +00:00
|
|
|
case SLOTDOORON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case LIGHTSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case LIGHTSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case SPACELIGHTSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case SPACELIGHTSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case SPACEDOORSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case SPACEDOORSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case FRANKENSTINESWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case FRANKENSTINESWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case LIGHTSWITCH2:
|
2022-11-25 09:03:15 +00:00
|
|
|
case LIGHTSWITCH2ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case POWERSWITCH1:
|
2022-11-25 09:03:15 +00:00
|
|
|
case POWERSWITCH1ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case LOCKSWITCH1:
|
2022-11-25 09:03:15 +00:00
|
|
|
case LOCKSWITCH1ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case POWERSWITCH2:
|
2022-11-25 09:03:15 +00:00
|
|
|
case POWERSWITCH2ON:
|
2022-11-21 07:15:41 +00:00
|
|
|
case CHICKENPLANTBUTTON:
|
2022-11-25 09:03:15 +00:00
|
|
|
case CHICKENPLANTBUTTONON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case RRTILE2214:
|
|
|
|
case RRTILE2697:
|
|
|
|
case RRTILE2697 + 1:
|
|
|
|
case RRTILE2707:
|
|
|
|
case RRTILE2707 + 1:
|
2020-08-11 22:31:04 +00:00
|
|
|
goOn1:
|
2020-05-12 11:43:24 +00:00
|
|
|
if (check_activator_motion(lotag)) return 0;
|
|
|
|
break;
|
|
|
|
default:
|
2022-11-25 16:29:27 +00:00
|
|
|
if (isadoorwall(picnum) == 0) return 0;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-10-26 06:02:36 +00:00
|
|
|
DukeStatIterator it(STAT_DEFAULT);
|
|
|
|
while (auto other = it.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-21 20:43:41 +00:00
|
|
|
if (lotag == other->spr.lotag) switch (other->spr.picnum)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
case DIPSWITCH:
|
|
|
|
case TECHSWITCH:
|
|
|
|
case ALIENSWITCH:
|
2021-12-21 20:43:41 +00:00
|
|
|
if (act && act == other) other->spr.picnum++;
|
|
|
|
else if (other->spr.hitag == 0) correctdips++;
|
2020-05-12 11:43:24 +00:00
|
|
|
numdips++;
|
|
|
|
break;
|
2022-11-25 09:03:15 +00:00
|
|
|
case TECHSWITCHON:
|
|
|
|
case DIPSWITCHON:
|
|
|
|
case ALIENSWITCHON:
|
2021-12-21 20:43:41 +00:00
|
|
|
if (act && act == other) other->spr.picnum--;
|
|
|
|
else if (other->spr.hitag == 1) correctdips++;
|
2020-05-12 11:43:24 +00:00
|
|
|
numdips++;
|
|
|
|
break;
|
|
|
|
case MULTISWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case MULTISWITCH_2:
|
|
|
|
case MULTISWITCH_3:
|
|
|
|
case MULTISWITCH_4:
|
2021-12-21 20:43:41 +00:00
|
|
|
other->spr.picnum++;
|
2022-11-25 09:03:15 +00:00
|
|
|
if (other->spr.picnum > (MULTISWITCH_4))
|
2021-12-21 20:43:41 +00:00
|
|
|
other->spr.picnum = MULTISWITCH;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case MULTISWITCH2:
|
2022-11-25 09:03:15 +00:00
|
|
|
case MULTISWITCH2_2:
|
|
|
|
case MULTISWITCH2_3:
|
|
|
|
case MULTISWITCH2_4:
|
2020-05-12 11:43:24 +00:00
|
|
|
if (!isRRRA()) break;
|
2021-12-21 20:43:41 +00:00
|
|
|
other->spr.picnum++;
|
2022-11-25 09:03:15 +00:00
|
|
|
if (other->spr.picnum > (MULTISWITCH2_4))
|
2021-12-21 20:43:41 +00:00
|
|
|
other->spr.picnum = MULTISWITCH2;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RRTILE2214:
|
2021-12-21 20:43:41 +00:00
|
|
|
other->spr.picnum++;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case RRTILE8660:
|
|
|
|
if (!isRRRA()) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-12 11:43:24 +00:00
|
|
|
case ACCESSSWITCH:
|
|
|
|
case ACCESSSWITCH2:
|
|
|
|
case SLOTDOOR:
|
|
|
|
case LIGHTSWITCH:
|
|
|
|
case SPACELIGHTSWITCH:
|
|
|
|
case SPACEDOORSWITCH:
|
|
|
|
case FRANKENSTINESWITCH:
|
|
|
|
case LIGHTSWITCH2:
|
|
|
|
case POWERSWITCH1:
|
|
|
|
case LOCKSWITCH1:
|
|
|
|
case POWERSWITCH2:
|
|
|
|
case HANDSWITCH:
|
|
|
|
case PULLSWITCH:
|
|
|
|
case DIPSWITCH2:
|
|
|
|
case DIPSWITCH3:
|
2022-11-21 07:15:41 +00:00
|
|
|
case CHICKENPLANTBUTTON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case RRTILE2697:
|
|
|
|
case RRTILE2707:
|
2021-12-21 20:43:41 +00:00
|
|
|
if (other->spr.picnum == DIPSWITCH3)
|
|
|
|
if (other->spr.hitag == 999)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-20 20:16:24 +00:00
|
|
|
DukeStatIterator it1(STAT_LUMBERMILL);
|
2020-10-26 06:10:45 +00:00
|
|
|
while (auto other2 = it1.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-21 20:33:27 +00:00
|
|
|
CallOnUse(other2, nullptr);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2021-12-21 20:43:41 +00:00
|
|
|
other->spr.picnum++;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-11-21 07:15:41 +00:00
|
|
|
if (other->spr.picnum == CHICKENPLANTBUTTON)
|
|
|
|
ud.chickenplant = 0;
|
2021-12-21 20:43:41 +00:00
|
|
|
if (other->spr.picnum == RRTILE8660)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
BellTime = 132;
|
2020-10-27 05:35:11 +00:00
|
|
|
BellSprite = other;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2021-12-21 20:43:41 +00:00
|
|
|
other->spr.picnum++;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
2022-11-25 09:03:15 +00:00
|
|
|
case PULLSWITCHON:
|
|
|
|
case HANDSWITCHON:
|
|
|
|
case LIGHTSWITCH2ON:
|
|
|
|
case POWERSWITCH1ON:
|
|
|
|
case LOCKSWITCH1ON:
|
|
|
|
case POWERSWITCH2ON:
|
|
|
|
case SLOTDOORON:
|
|
|
|
case LIGHTSWITCHON:
|
|
|
|
case SPACELIGHTSWITCHON:
|
|
|
|
case SPACEDOORSWITCHON:
|
|
|
|
case FRANKENSTINESWITCHON:
|
|
|
|
case DIPSWITCH2ON:
|
|
|
|
case DIPSWITCH3ON:
|
|
|
|
case CHICKENPLANTBUTTONON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case RRTILE2697 + 1:
|
|
|
|
case RRTILE2707 + 1:
|
2022-11-25 09:03:15 +00:00
|
|
|
if (other->spr.picnum == CHICKENPLANTBUTTONON)
|
2022-11-21 07:15:41 +00:00
|
|
|
ud.chickenplant = 1;
|
2021-12-21 20:43:41 +00:00
|
|
|
if (other->spr.hitag != 999)
|
|
|
|
other->spr.picnum--;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-21 08:23:39 +00:00
|
|
|
for (auto& wal : wall)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-17 22:10:25 +00:00
|
|
|
if (lotag == wal.lotag)
|
|
|
|
switch (wal.picnum)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
case DIPSWITCH:
|
|
|
|
case TECHSWITCH:
|
|
|
|
case ALIENSWITCH:
|
2021-11-17 22:10:25 +00:00
|
|
|
if (!act && &wal == wwal) wal.picnum++;
|
|
|
|
else if (wal.hitag == 0) correctdips++;
|
2020-05-12 11:43:24 +00:00
|
|
|
numdips++;
|
|
|
|
break;
|
2022-11-25 09:03:15 +00:00
|
|
|
case DIPSWITCHON:
|
|
|
|
case TECHSWITCHON:
|
|
|
|
case ALIENSWITCHON:
|
2021-11-17 22:10:25 +00:00
|
|
|
if (!act && &wal == wwal) wal.picnum--;
|
|
|
|
else if (wal.hitag == 1) correctdips++;
|
2020-05-12 11:43:24 +00:00
|
|
|
numdips++;
|
|
|
|
break;
|
|
|
|
case MULTISWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case MULTISWITCH_2:
|
|
|
|
case MULTISWITCH_3:
|
|
|
|
case MULTISWITCH_4:
|
2021-11-17 22:10:25 +00:00
|
|
|
wal.picnum++;
|
2022-11-25 09:03:15 +00:00
|
|
|
if (wal.picnum > (MULTISWITCH_4))
|
2021-11-17 22:10:25 +00:00
|
|
|
wal.picnum = MULTISWITCH;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case MULTISWITCH2:
|
2022-11-25 09:03:15 +00:00
|
|
|
case MULTISWITCH2_2:
|
|
|
|
case MULTISWITCH2_3:
|
|
|
|
case MULTISWITCH2_4:
|
2020-05-12 11:43:24 +00:00
|
|
|
if (!isRRRA()) break;
|
2021-11-17 22:10:25 +00:00
|
|
|
wal.picnum++;
|
2022-11-25 09:03:15 +00:00
|
|
|
if (wal.picnum > (MULTISWITCH2_4))
|
2021-11-17 22:10:25 +00:00
|
|
|
wal.picnum = MULTISWITCH2;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case RRTILE8660:
|
|
|
|
if (!isRRRA()) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-12 11:43:24 +00:00
|
|
|
case ACCESSSWITCH:
|
|
|
|
case ACCESSSWITCH2:
|
|
|
|
case SLOTDOOR:
|
|
|
|
case LIGHTSWITCH:
|
|
|
|
case SPACELIGHTSWITCH:
|
|
|
|
case SPACEDOORSWITCH:
|
|
|
|
case LIGHTSWITCH2:
|
|
|
|
case POWERSWITCH1:
|
|
|
|
case LOCKSWITCH1:
|
|
|
|
case POWERSWITCH2:
|
|
|
|
case PULLSWITCH:
|
|
|
|
case HANDSWITCH:
|
|
|
|
case DIPSWITCH2:
|
|
|
|
case DIPSWITCH3:
|
|
|
|
case RRTILE2697:
|
|
|
|
case RRTILE2707:
|
2021-11-17 22:10:25 +00:00
|
|
|
wal.picnum++;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
2022-11-25 09:03:15 +00:00
|
|
|
case HANDSWITCHON:
|
|
|
|
case PULLSWITCHON:
|
|
|
|
case LIGHTSWITCH2ON:
|
|
|
|
case POWERSWITCH1ON:
|
|
|
|
case LOCKSWITCH1ON:
|
|
|
|
case POWERSWITCH2ON:
|
|
|
|
case SLOTDOORON:
|
|
|
|
case LIGHTSWITCHON:
|
|
|
|
case SPACELIGHTSWITCHON:
|
|
|
|
case SPACEDOORSWITCHON:
|
|
|
|
case DIPSWITCH2ON:
|
|
|
|
case DIPSWITCH3ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case RRTILE2697 + 1:
|
|
|
|
case RRTILE2707 + 1:
|
2021-11-17 22:10:25 +00:00
|
|
|
wal.picnum--;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-14 14:03:50 +00:00
|
|
|
if (lotag == -1)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-07-07 15:56:20 +00:00
|
|
|
setnextmap(false);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
|
2022-11-21 04:20:08 +00:00
|
|
|
DVector3 v(pos, ps[snum].GetActor()->getOffsetZ());
|
2020-05-12 11:43:24 +00:00
|
|
|
switch (picnum)
|
|
|
|
{
|
|
|
|
default:
|
2022-11-25 16:29:27 +00:00
|
|
|
if (isadoorwall(picnum) == 0) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-12 11:43:24 +00:00
|
|
|
case DIPSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case DIPSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case TECHSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case TECHSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case ALIENSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case ALIENSWITCHON:
|
|
|
|
if (picnum == DIPSWITCH || picnum == DIPSWITCHON ||
|
|
|
|
picnum == ALIENSWITCH || picnum == ALIENSWITCHON ||
|
|
|
|
picnum == TECHSWITCH || picnum == TECHSWITCHON)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-25 09:03:15 +00:00
|
|
|
if (picnum == ALIENSWITCH || picnum == ALIENSWITCHON)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-10-26 06:30:34 +00:00
|
|
|
if (act)
|
2022-01-30 22:20:00 +00:00
|
|
|
S_PlaySound3D(ALIEN_SWITCH1, act, v);
|
|
|
|
else S_PlaySound3D(ALIEN_SWITCH1, ps[snum].GetActor(), v);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-26 06:30:34 +00:00
|
|
|
if (act)
|
2022-01-30 22:20:00 +00:00
|
|
|
S_PlaySound3D(SWITCH_ON, act, v);
|
|
|
|
else S_PlaySound3D(SWITCH_ON, ps[snum].GetActor(), v);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
if (numdips != correctdips) break;
|
2022-01-30 22:20:00 +00:00
|
|
|
S_PlaySound3D(END_OF_LEVEL_WARN, ps[snum].GetActor(), v);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2020-08-11 22:31:04 +00:00
|
|
|
goto goOn2;
|
2020-05-12 11:43:24 +00:00
|
|
|
case MULTISWITCH2:
|
2022-11-25 09:03:15 +00:00
|
|
|
case MULTISWITCH2_2:
|
|
|
|
case MULTISWITCH2_3:
|
|
|
|
case MULTISWITCH2_4:
|
|
|
|
case IRONWHEELSWITCH:
|
2020-05-12 11:43:24 +00:00
|
|
|
case RRTILE8660:
|
|
|
|
if (!isRRRA()) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-12 11:43:24 +00:00
|
|
|
case DIPSWITCH2:
|
2022-11-25 09:03:15 +00:00
|
|
|
case DIPSWITCH2ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case DIPSWITCH3:
|
2022-11-25 09:03:15 +00:00
|
|
|
case DIPSWITCH3ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case MULTISWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case MULTISWITCH_2:
|
|
|
|
case MULTISWITCH_3:
|
|
|
|
case MULTISWITCH_4:
|
2020-05-12 11:43:24 +00:00
|
|
|
case ACCESSSWITCH:
|
|
|
|
case ACCESSSWITCH2:
|
|
|
|
case SLOTDOOR:
|
2022-11-25 09:03:15 +00:00
|
|
|
case SLOTDOORON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case LIGHTSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case LIGHTSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case SPACELIGHTSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case SPACELIGHTSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case SPACEDOORSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case SPACEDOORSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case FRANKENSTINESWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case FRANKENSTINESWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case LIGHTSWITCH2:
|
2022-11-25 09:03:15 +00:00
|
|
|
case LIGHTSWITCH2ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case POWERSWITCH1:
|
2022-11-25 09:03:15 +00:00
|
|
|
case POWERSWITCH1ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case LOCKSWITCH1:
|
2022-11-25 09:03:15 +00:00
|
|
|
case LOCKSWITCH1ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case POWERSWITCH2:
|
2022-11-25 09:03:15 +00:00
|
|
|
case POWERSWITCH2ON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case HANDSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case HANDSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case PULLSWITCH:
|
2022-11-25 09:03:15 +00:00
|
|
|
case PULLSWITCHON:
|
2020-05-12 11:43:24 +00:00
|
|
|
case RRTILE2697:
|
|
|
|
case RRTILE2697 + 1:
|
|
|
|
case RRTILE2707:
|
|
|
|
case RRTILE2707 + 1:
|
2020-08-11 22:31:04 +00:00
|
|
|
goOn2:
|
2020-05-12 11:43:24 +00:00
|
|
|
if (isRRRA())
|
|
|
|
{
|
2020-10-26 06:30:34 +00:00
|
|
|
if (picnum == RRTILE8660 && act)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
BellTime = 132;
|
2020-10-26 06:30:34 +00:00
|
|
|
BellSprite = act;
|
2021-12-21 17:19:45 +00:00
|
|
|
act->spr.picnum++;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2022-11-25 09:03:15 +00:00
|
|
|
else if (picnum == IRONWHEELSWITCH)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
act->spr.picnum = act->spr.picnum + 1;
|
2020-05-12 11:43:24 +00:00
|
|
|
if (hitag == 10001)
|
|
|
|
{
|
|
|
|
if (ps[snum].SeaSick == 0)
|
|
|
|
ps[snum].SeaSick = 350;
|
2022-11-19 14:40:35 +00:00
|
|
|
operateactivators(668, &ps[snum]);
|
2020-05-12 11:43:24 +00:00
|
|
|
operatemasterswitches(668);
|
2020-10-26 05:55:16 +00:00
|
|
|
S_PlayActorSound(328, ps[snum].GetActor());
|
2020-05-12 11:43:24 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (hitag == 10000)
|
|
|
|
{
|
2022-11-25 09:03:15 +00:00
|
|
|
if (picnum == MULTISWITCH || picnum == (MULTISWITCH_2) ||
|
|
|
|
picnum == (MULTISWITCH_3) || picnum == (MULTISWITCH_4) ||
|
|
|
|
picnum == MULTISWITCH2 || picnum == (MULTISWITCH2_2) ||
|
|
|
|
picnum == (MULTISWITCH2_3) || picnum == (MULTISWITCH2_4))
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-10-26 06:30:34 +00:00
|
|
|
DDukeActor* switches[3];
|
|
|
|
int switchcount = 0, j;
|
2022-01-30 22:20:00 +00:00
|
|
|
S_PlaySound3D(SWITCH_ON, act, v);
|
2021-12-24 09:53:27 +00:00
|
|
|
DukeSpriteIterator itr;
|
|
|
|
while (auto actt = itr.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
int jpn = actt->spr.picnum;
|
|
|
|
int jht = actt->spr.hitag;
|
2020-05-12 11:43:24 +00:00
|
|
|
if ((jpn == MULTISWITCH || jpn == MULTISWITCH2) && jht == 10000)
|
|
|
|
{
|
2020-10-24 05:48:51 +00:00
|
|
|
if (switchcount < 3)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-10-26 06:30:34 +00:00
|
|
|
switches[switchcount] = actt;
|
2020-10-24 05:48:51 +00:00
|
|
|
switchcount++;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-24 05:48:51 +00:00
|
|
|
if (switchcount == 3)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-04 12:02:38 +00:00
|
|
|
// This once was a linear search over sprites[] so bring things back in order, just to be safe.
|
|
|
|
if (switches[0]->GetIndex() > switches[1]->GetIndex()) std::swap(switches[0], switches[1]);
|
|
|
|
if (switches[0]->GetIndex() > switches[2]->GetIndex()) std::swap(switches[0], switches[2]);
|
|
|
|
if (switches[1]->GetIndex() > switches[2]->GetIndex()) std::swap(switches[1], switches[2]);
|
|
|
|
|
2022-01-30 22:20:00 +00:00
|
|
|
S_PlaySound3D(78, act, v);
|
2020-10-24 05:48:51 +00:00
|
|
|
for (j = 0; j < switchcount; j++)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
switches[j]->spr.hitag = 0;
|
2020-05-12 11:43:24 +00:00
|
|
|
if (picnum >= MULTISWITCH2)
|
2022-11-25 09:03:15 +00:00
|
|
|
switches[j]->spr.picnum = MULTISWITCH2_4;
|
2020-05-12 11:43:24 +00:00
|
|
|
else
|
2022-11-25 09:03:15 +00:00
|
|
|
switches[j]->spr.picnum = MULTISWITCH_4;
|
2021-11-17 23:16:53 +00:00
|
|
|
checkhitswitch_r(snum, nullptr, switches[j]);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-11-25 09:03:15 +00:00
|
|
|
if (picnum == MULTISWITCH || picnum == (MULTISWITCH_2) ||
|
|
|
|
picnum == (MULTISWITCH_3) || picnum == (MULTISWITCH_4))
|
2020-05-12 11:43:24 +00:00
|
|
|
lotag += picnum - MULTISWITCH;
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
2022-11-25 09:03:15 +00:00
|
|
|
if (picnum == MULTISWITCH2 || picnum == (MULTISWITCH2_2) ||
|
|
|
|
picnum == (MULTISWITCH2_3) || picnum == (MULTISWITCH2_4))
|
2020-05-12 11:43:24 +00:00
|
|
|
lotag += picnum - MULTISWITCH2;
|
|
|
|
}
|
|
|
|
|
2021-12-24 09:53:27 +00:00
|
|
|
DukeStatIterator itr(STAT_EFFECTOR);
|
|
|
|
while (auto other = itr.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (other->spr.hitag == lotag)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
switch (other->spr.lotag)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
case 46:
|
2020-08-11 22:31:04 +00:00
|
|
|
case SE_47_LIGHT_SWITCH:
|
|
|
|
case SE_48_LIGHT_SWITCH:
|
2020-05-12 11:43:24 +00:00
|
|
|
if (!isRRRA()) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-08-11 22:31:04 +00:00
|
|
|
case SE_12_LIGHT_SWITCH:
|
2021-11-20 23:33:17 +00:00
|
|
|
other->sector()->floorpal = 0;
|
2020-10-26 06:02:36 +00:00
|
|
|
other->temp_data[0]++;
|
|
|
|
if (other->temp_data[0] == 2)
|
|
|
|
other->temp_data[0]++;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
|
|
|
break;
|
2020-08-11 22:31:04 +00:00
|
|
|
case SE_24_CONVEYOR:
|
|
|
|
case SE_34:
|
|
|
|
case SE_25_PISTON:
|
2020-10-26 06:02:36 +00:00
|
|
|
other->temp_data[4] = !other->temp_data[4];
|
|
|
|
if (other->temp_data[4])
|
2020-05-12 11:43:24 +00:00
|
|
|
FTA(15, &ps[snum]);
|
|
|
|
else FTA(2, &ps[snum]);
|
|
|
|
break;
|
2020-08-11 22:31:04 +00:00
|
|
|
case SE_21_DROP_FLOOR:
|
2020-05-12 11:43:24 +00:00
|
|
|
FTA(2, &ps[screenpeek]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-19 14:40:35 +00:00
|
|
|
operateactivators(lotag, &ps[snum]);
|
2020-11-02 18:53:04 +00:00
|
|
|
fi.operateforcefields(ps[snum].GetActor(), lotag);
|
2020-05-12 11:43:24 +00:00
|
|
|
operatemasterswitches(lotag);
|
|
|
|
|
2022-11-25 09:03:15 +00:00
|
|
|
if (picnum == DIPSWITCH || picnum == DIPSWITCHON ||
|
|
|
|
picnum == ALIENSWITCH || picnum == ALIENSWITCHON ||
|
|
|
|
picnum == TECHSWITCH || picnum == TECHSWITCHON) return 1;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2022-11-25 16:29:27 +00:00
|
|
|
if (hitag == 0 && isadoorwall(picnum) == 0)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-10-26 06:30:34 +00:00
|
|
|
if (act)
|
2022-01-30 22:20:00 +00:00
|
|
|
S_PlaySound3D(SWITCH_ON, act, v);
|
|
|
|
else S_PlaySound3D(SWITCH_ON, ps[snum].GetActor(), v);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
else if (hitag != 0)
|
|
|
|
{
|
|
|
|
auto flags = S_GetUserFlags(hitag);
|
|
|
|
|
2020-10-26 06:30:34 +00:00
|
|
|
if (act && (flags & SF_TALK) == 0)
|
2022-01-30 22:20:00 +00:00
|
|
|
S_PlaySound3D(hitag, act, v);
|
2020-05-12 11:43:24 +00:00
|
|
|
else
|
2020-10-26 05:55:16 +00:00
|
|
|
S_PlayActorSound(hitag, ps[snum].GetActor());
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
2020-05-10 16:05:36 +00:00
|
|
|
}
|
2020-05-10 10:42:47 +00:00
|
|
|
|
2020-05-10 18:59:38 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-18 17:51:19 +00:00
|
|
|
void activatebysector_r(sectortype* sect, DDukeActor* activator)
|
2020-05-10 18:59:38 +00:00
|
|
|
{
|
2020-11-02 18:28:59 +00:00
|
|
|
DukeSectIterator it(sect);
|
|
|
|
while (auto act = it.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-20 11:43:24 +00:00
|
|
|
if (isactivator(act))
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-19 14:40:35 +00:00
|
|
|
operateactivators(act->spr.lotag, nullptr);
|
2020-05-12 11:43:24 +00:00
|
|
|
// return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-18 17:51:19 +00:00
|
|
|
if (sect->lotag != 22)
|
2020-11-02 18:28:59 +00:00
|
|
|
operatesectors(sect, activator);
|
2020-05-10 18:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-16 10:47:01 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-17 23:40:40 +00:00
|
|
|
static void lotsofpopcorn(DDukeActor *actor, walltype* wal, int n)
|
2020-05-16 10:47:01 +00:00
|
|
|
{
|
2021-11-18 17:51:19 +00:00
|
|
|
sectortype* sect = nullptr;
|
2020-05-16 10:47:01 +00:00
|
|
|
|
2021-11-17 23:40:40 +00:00
|
|
|
if (wal == nullptr)
|
2020-05-16 10:47:01 +00:00
|
|
|
{
|
2022-09-13 18:35:14 +00:00
|
|
|
for (int j = n - 1; j >= 0; j--)
|
2020-05-16 10:47:01 +00:00
|
|
|
{
|
2022-11-25 12:13:50 +00:00
|
|
|
DAngle a = actor->spr.Angles.Yaw - DAngle45 + DAngle180 + randomAngle(90);
|
2022-09-14 18:44:10 +00:00
|
|
|
auto vel = krandf(4) + 2;
|
|
|
|
auto zvel = 4 - krandf(4);
|
|
|
|
|
2022-10-07 16:57:09 +00:00
|
|
|
CreateActor(actor->sector(), actor->spr.pos, POPCORN, -32, DVector2(0.5625, 0.5625), a, vel, zvel, actor, 5);
|
2020-05-16 10:47:01 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-09-13 18:35:14 +00:00
|
|
|
auto pos = wal->pos;
|
|
|
|
auto delta = wal->delta() / (n + 1);
|
2020-05-16 10:47:01 +00:00
|
|
|
|
2022-09-13 18:35:14 +00:00
|
|
|
pos.X -= Sgn(delta.X) * maptoworld;
|
|
|
|
pos.Y += Sgn(delta.Y) * maptoworld;
|
2020-05-16 10:47:01 +00:00
|
|
|
|
2022-09-13 18:35:14 +00:00
|
|
|
for (int j = n; j > 0; j--)
|
2020-05-16 10:47:01 +00:00
|
|
|
{
|
2022-09-13 18:35:14 +00:00
|
|
|
pos += delta;
|
|
|
|
sect = actor->sector();
|
|
|
|
updatesector(DVector3(pos, sect->floorz), §);
|
2021-11-18 17:51:19 +00:00
|
|
|
if (sect)
|
2020-05-16 10:47:01 +00:00
|
|
|
{
|
2022-09-13 18:35:14 +00:00
|
|
|
double z = sect->floorz - krandf(abs(sect->ceilingz - sect->floorz));
|
|
|
|
if (abs(z) > 32)
|
|
|
|
z = actor->spr.pos.Z - 32 + krandf(64);
|
2022-11-25 12:13:50 +00:00
|
|
|
DAngle a = actor->spr.Angles.Yaw - DAngle180;
|
2022-09-14 18:44:10 +00:00
|
|
|
auto vel = krandf(4) + 2;
|
|
|
|
auto zvel = -krandf(4);
|
|
|
|
|
2022-10-07 16:57:09 +00:00
|
|
|
CreateActor(actor->sector(), DVector3(pos, z), POPCORN, -32, DVector2(0.5625, 0.5625), a, vel, zvel, actor, 5);
|
2020-05-16 10:47:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-10 18:59:38 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-08-23 20:39:07 +00:00
|
|
|
void checkhitwall_r(DDukeActor* spr, walltype* wal, const DVector3& pos, int atwith)
|
2020-05-10 18:59:38 +00:00
|
|
|
{
|
2021-11-15 23:30:01 +00:00
|
|
|
int j;
|
2022-08-23 20:39:07 +00:00
|
|
|
int darkestwall;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2022-11-29 16:36:01 +00:00
|
|
|
if (wal->overpicnum == MIRROR && atwith != -1 && gs.actorinfo[atwith].flags2 & SFLAG2_BREAKMIRRORS)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-01-20 07:31:08 +00:00
|
|
|
lotsofglass(spr, wal, 70);
|
|
|
|
wal->cstat &= ~CSTAT_WALL_MASKED;
|
|
|
|
wal->overpicnum = MIRRORBROKE;
|
|
|
|
wal->portalflags = 0;
|
|
|
|
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
|
|
|
|
return;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
|
2021-12-18 14:11:21 +00:00
|
|
|
if (((wal->cstat & CSTAT_WALL_MASKED) || wal->overpicnum == BIGFORCE) && wal->twoSided())
|
2022-08-23 20:39:07 +00:00
|
|
|
if (wal->nextSector()->floorz > pos.Z)
|
2022-08-28 09:35:03 +00:00
|
|
|
if (wal->nextSector()->floorz - wal->nextSector()->ceilingz)
|
2020-05-12 11:43:24 +00:00
|
|
|
switch (wal->overpicnum)
|
|
|
|
{
|
|
|
|
case FANSPRITE:
|
|
|
|
wal->overpicnum = FANSPRITEBROKE;
|
2021-12-18 14:11:21 +00:00
|
|
|
wal->cstat &= ~(CSTAT_WALL_BLOCK | CSTAT_WALL_BLOCK_HITSCAN);
|
2021-11-21 07:42:36 +00:00
|
|
|
if (wal->twoSided())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-07 07:46:15 +00:00
|
|
|
wal->nextWall()->overpicnum = FANSPRITEBROKE;
|
2021-12-18 14:11:21 +00:00
|
|
|
wal->nextWall()->cstat &= ~(CSTAT_WALL_BLOCK | CSTAT_WALL_BLOCK_HITSCAN);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlayActorSound(VENT_BUST, spr);
|
|
|
|
S_PlayActorSound(GLASS_BREAKING, spr);
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
case RRTILE1973:
|
2020-10-24 05:22:44 +00:00
|
|
|
{
|
2021-11-18 18:04:00 +00:00
|
|
|
sectortype* sptr = nullptr;
|
2022-08-23 20:39:07 +00:00
|
|
|
updatesector(pos, &sptr);
|
2021-11-18 18:04:00 +00:00
|
|
|
if (sptr == nullptr) return;
|
2020-05-12 11:43:24 +00:00
|
|
|
wal->overpicnum = GLASS2;
|
2021-11-17 23:40:40 +00:00
|
|
|
lotsofpopcorn(spr, wal, 64);
|
2020-05-12 11:43:24 +00:00
|
|
|
wal->cstat = 0;
|
|
|
|
|
2021-11-21 07:42:36 +00:00
|
|
|
if (wal->twoSided())
|
2021-11-07 07:46:15 +00:00
|
|
|
wal->nextWall()->cstat = 0;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2022-11-25 11:30:40 +00:00
|
|
|
auto spawned = CreateActor(sptr, pos, SECTOREFFECTOR, 0, DVector2(0, 0), ps[0].GetActor()->spr.Angles.Yaw, 0., 0., spr, 3);
|
2021-11-19 08:47:17 +00:00
|
|
|
if (spawned)
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.lotag = SE_128_GLASS_BREAKING;
|
2021-11-19 08:47:17 +00:00
|
|
|
spawned->temp_walls[0] = wal;
|
|
|
|
S_PlayActorSound(GLASS_BREAKING, spawned);
|
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
2020-10-24 05:22:44 +00:00
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
case GLASS:
|
2020-10-24 05:22:44 +00:00
|
|
|
{
|
2021-11-18 18:04:00 +00:00
|
|
|
sectortype* sptr = nullptr;
|
2022-08-23 20:39:07 +00:00
|
|
|
updatesector(pos, &sptr);
|
2021-11-18 18:04:00 +00:00
|
|
|
if (sptr == nullptr) return;
|
2020-05-12 11:43:24 +00:00
|
|
|
wal->overpicnum = GLASS2;
|
2021-11-17 23:38:20 +00:00
|
|
|
lotsofglass(spr, wal, 10);
|
2020-05-12 11:43:24 +00:00
|
|
|
wal->cstat = 0;
|
|
|
|
|
2021-11-21 07:42:36 +00:00
|
|
|
if (wal->twoSided())
|
2021-11-07 07:46:15 +00:00
|
|
|
wal->nextWall()->cstat = 0;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2022-11-25 11:30:40 +00:00
|
|
|
auto spawned = CreateActor(sptr, pos, SECTOREFFECTOR, 0, DVector2(0, 0), ps[0].GetActor()->spr.Angles.Yaw, 0., 0., spr, 3);
|
2021-11-19 08:47:17 +00:00
|
|
|
if (spawned)
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.lotag = SE_128_GLASS_BREAKING;
|
2021-11-19 08:47:17 +00:00
|
|
|
spawned->temp_data[1] = 2;
|
|
|
|
spawned->temp_walls[0] = wal;
|
|
|
|
S_PlayActorSound(GLASS_BREAKING, spawned);
|
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
2020-10-24 05:22:44 +00:00
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
case STAINGLASS1:
|
2022-08-23 20:39:07 +00:00
|
|
|
{
|
|
|
|
sectortype* sptr = nullptr;
|
|
|
|
updatesector(pos, &sptr);
|
|
|
|
if (sptr == nullptr) return;
|
2021-11-17 23:38:20 +00:00
|
|
|
lotsofcolourglass(spr, wal, 80);
|
2020-05-12 11:43:24 +00:00
|
|
|
wal->cstat = 0;
|
2021-11-21 07:42:36 +00:00
|
|
|
if (wal->twoSided())
|
2021-11-07 07:46:15 +00:00
|
|
|
wal->nextWall()->cstat = 0;
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlayActorSound(VENT_BUST, spr);
|
|
|
|
S_PlayActorSound(GLASS_BREAKING, spr);
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2022-08-23 20:39:07 +00:00
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2022-12-04 08:18:57 +00:00
|
|
|
auto data = breakWallMap.CheckKey(wal->picnum);
|
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
if (!data->handler)
|
|
|
|
{
|
|
|
|
wal->picnum = data->brokentex;
|
2022-12-04 12:09:47 +00:00
|
|
|
S_PlayActorSound(data->breaksound, spr);
|
2022-12-04 08:18:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-12-04 12:09:47 +00:00
|
|
|
VMValue args[4] = { wal, data->brokentex, data->breaksound.index(), spr};
|
2022-12-04 08:18:57 +00:00
|
|
|
VMCall(data->handler, args, 4, nullptr, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else switch (wal->picnum)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-25 09:03:15 +00:00
|
|
|
case IRONWHEELSWITCH:
|
2020-05-12 11:43:24 +00:00
|
|
|
if (isRRRA()) break;
|
|
|
|
break;
|
2022-11-29 19:55:02 +00:00
|
|
|
case PICKUPSIDE:
|
|
|
|
case PICKUPFRONT:
|
|
|
|
case PICKUPBACK1:
|
|
|
|
case PICKUPBACK2:
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-21 07:42:36 +00:00
|
|
|
auto sect = wal->nextWall()->nextSector();
|
2020-11-02 19:33:44 +00:00
|
|
|
DukeSectIterator it(sect);
|
|
|
|
while (auto act = it.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-21 20:43:41 +00:00
|
|
|
if (act->spr.lotag == 6)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-11-02 19:33:44 +00:00
|
|
|
act->spriteextra++;
|
|
|
|
if (act->spriteextra == 25)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-15 14:24:17 +00:00
|
|
|
for(auto& wl : act->sector()->walls)
|
2021-11-17 23:42:52 +00:00
|
|
|
{
|
2021-11-21 07:42:36 +00:00
|
|
|
if (wl.twoSided()) wl.nextSector()->lotag = 0;
|
2021-11-17 23:42:52 +00:00
|
|
|
}
|
2021-12-30 15:51:56 +00:00
|
|
|
act->sector()->lotag = 0;
|
2021-12-21 17:19:45 +00:00
|
|
|
S_StopSound(act->spr.lotag);
|
2020-11-02 19:33:44 +00:00
|
|
|
S_PlayActorSound(400, act);
|
2022-11-20 18:25:23 +00:00
|
|
|
act->Destroy();
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case COLAMACHINE:
|
|
|
|
case VENDMACHINE:
|
2021-11-17 23:32:46 +00:00
|
|
|
breakwall(wal->picnum + 2, spr, wal);
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlayActorSound(GLASS_BREAKING, spr);
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
case OJ:
|
|
|
|
|
|
|
|
case SCREENBREAK6:
|
|
|
|
case SCREENBREAK7:
|
|
|
|
case SCREENBREAK8:
|
|
|
|
|
2021-11-17 23:38:20 +00:00
|
|
|
lotsofglass(spr, wal, 30);
|
2020-05-12 11:43:24 +00:00
|
|
|
wal->picnum = W_SCREENBREAK + (krand() % (isRRRA() ? 2 : 3));
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
case ATM:
|
|
|
|
wal->picnum = ATMBROKE;
|
2020-10-24 05:22:44 +00:00
|
|
|
fi.lotsofmoney(spr, 1 + (krand() & 7));
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WALLLIGHT1:
|
|
|
|
case WALLLIGHT3:
|
|
|
|
case WALLLIGHT4:
|
|
|
|
case TECHLIGHT2:
|
|
|
|
case TECHLIGHT4:
|
|
|
|
case RRTILE1814:
|
|
|
|
case RRTILE1939:
|
|
|
|
case RRTILE1986:
|
|
|
|
case RRTILE1988:
|
|
|
|
case RRTILE2123:
|
|
|
|
case RRTILE2125:
|
|
|
|
case RRTILE2636:
|
|
|
|
case RRTILE2878:
|
|
|
|
case RRTILE2898:
|
|
|
|
case RRTILE3200:
|
|
|
|
case RRTILE3202:
|
|
|
|
case RRTILE3204:
|
|
|
|
case RRTILE3206:
|
|
|
|
case RRTILE3208:
|
|
|
|
|
|
|
|
if (rnd(128))
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
|
|
|
|
else S_PlayActorSound(GLASS_BREAKING, spr);
|
2021-11-17 23:38:20 +00:00
|
|
|
lotsofglass(spr, wal, 30);
|
2020-05-12 11:43:24 +00:00
|
|
|
|
|
|
|
if (wal->picnum == RRTILE1814)
|
|
|
|
wal->picnum = RRTILE1817;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE1986)
|
|
|
|
wal->picnum = RRTILE1987;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE1939)
|
|
|
|
wal->picnum = RRTILE2004;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE1988)
|
|
|
|
wal->picnum = RRTILE2005;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE2898)
|
|
|
|
wal->picnum = RRTILE2899;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE2878)
|
|
|
|
wal->picnum = RRTILE2879;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE2123)
|
|
|
|
wal->picnum = RRTILE2124;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE2125)
|
|
|
|
wal->picnum = RRTILE2126;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE3200)
|
|
|
|
wal->picnum = RRTILE3201;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE3202)
|
|
|
|
wal->picnum = RRTILE3203;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE3204)
|
|
|
|
wal->picnum = RRTILE3205;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE3206)
|
|
|
|
wal->picnum = RRTILE3207;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE3208)
|
|
|
|
wal->picnum = RRTILE3209;
|
|
|
|
|
|
|
|
if (wal->picnum == RRTILE2636)
|
|
|
|
wal->picnum = RRTILE2637;
|
|
|
|
|
|
|
|
if (wal->picnum == WALLLIGHT1)
|
|
|
|
wal->picnum = WALLLIGHTBUST1;
|
|
|
|
|
|
|
|
if (wal->picnum == WALLLIGHT3)
|
|
|
|
wal->picnum = WALLLIGHTBUST3;
|
|
|
|
|
|
|
|
if (wal->picnum == WALLLIGHT4)
|
|
|
|
wal->picnum = WALLLIGHTBUST4;
|
|
|
|
|
|
|
|
if (wal->picnum == TECHLIGHT2)
|
|
|
|
wal->picnum = TECHLIGHTBUST2;
|
|
|
|
|
|
|
|
if (wal->picnum == TECHLIGHT4)
|
|
|
|
wal->picnum = TECHLIGHTBUST4;
|
|
|
|
|
|
|
|
if (!wal->lotag) return;
|
|
|
|
|
2021-11-21 07:42:36 +00:00
|
|
|
if (!wal->twoSided()) return;
|
2020-05-12 11:43:24 +00:00
|
|
|
darkestwall = 0;
|
|
|
|
|
2022-11-15 14:24:17 +00:00
|
|
|
for (auto& wl : wal->nextSector()->walls)
|
2021-11-17 23:50:33 +00:00
|
|
|
if (wl.shade > darkestwall)
|
|
|
|
darkestwall = wl.shade;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
|
|
|
j = krand() & 1;
|
2020-11-02 19:33:44 +00:00
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
while (auto act = it.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-08-29 21:13:54 +00:00
|
|
|
if (act->spr.hitag == wal->lotag && act->spr.lotag == SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-11-02 19:33:44 +00:00
|
|
|
act->temp_data[2] = j;
|
|
|
|
act->temp_data[3] = darkestwall;
|
|
|
|
act->temp_data[4] = 1;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2020-05-10 18:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-02-07 10:04:19 +00:00
|
|
|
void checkplayerhurt_r(player_struct* p, const Collision &coll)
|
2020-05-10 18:59:38 +00:00
|
|
|
{
|
2020-10-25 07:50:03 +00:00
|
|
|
if (coll.type == kHitSprite)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-22 16:53:46 +00:00
|
|
|
CallOnHurt(coll.actor(), p);
|
|
|
|
return;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
|
2022-11-22 16:53:46 +00:00
|
|
|
if (coll.type == kHitWall)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-22 16:53:46 +00:00
|
|
|
auto wal = coll.hitWall;
|
|
|
|
|
|
|
|
if (p->hurt_delay > 0) p->hurt_delay--;
|
|
|
|
else if (wal->cstat & (CSTAT_WALL_BLOCK | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_MASKED | CSTAT_WALL_BLOCK_HITSCAN)) switch (wal->overpicnum)
|
|
|
|
{
|
|
|
|
case BIGFORCE:
|
|
|
|
p->hurt_delay = 26;
|
2022-11-25 11:30:40 +00:00
|
|
|
fi.checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->GetActor()->spr.Angles.Yaw.ToVector() * 2, -1);
|
2022-11-22 16:53:46 +00:00
|
|
|
break;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2022-11-22 16:53:46 +00:00
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2020-05-10 18:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-18 16:55:08 +00:00
|
|
|
bool checkhitceiling_r(sectortype* sectp)
|
2020-05-10 18:59:38 +00:00
|
|
|
{
|
2021-11-07 13:55:28 +00:00
|
|
|
int j;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
switch (sectp->ceilingpicnum)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
case WALLLIGHT1:
|
|
|
|
case WALLLIGHT3:
|
|
|
|
case WALLLIGHT4:
|
|
|
|
case TECHLIGHT2:
|
|
|
|
case TECHLIGHT4:
|
|
|
|
case RRTILE1939:
|
|
|
|
case RRTILE1986:
|
|
|
|
case RRTILE1988:
|
|
|
|
case RRTILE2123:
|
|
|
|
case RRTILE2125:
|
|
|
|
case RRTILE2878:
|
|
|
|
case RRTILE2898:
|
|
|
|
|
|
|
|
|
2021-11-18 16:55:08 +00:00
|
|
|
ceilingglass(ps[myconnectindex].GetActor(), sectp, 10);
|
2020-11-02 19:23:30 +00:00
|
|
|
S_PlayActorSound(GLASS_BREAKING, ps[screenpeek].GetActor());
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == WALLLIGHT1)
|
|
|
|
sectp->ceilingpicnum = WALLLIGHTBUST1;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == WALLLIGHT3)
|
|
|
|
sectp->ceilingpicnum = WALLLIGHTBUST3;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == WALLLIGHT4)
|
|
|
|
sectp->ceilingpicnum = WALLLIGHTBUST4;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == TECHLIGHT2)
|
|
|
|
sectp->ceilingpicnum = TECHLIGHTBUST2;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == TECHLIGHT4)
|
|
|
|
sectp->ceilingpicnum = TECHLIGHTBUST4;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == RRTILE1986)
|
|
|
|
sectp->ceilingpicnum = RRTILE1987;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == RRTILE1939)
|
|
|
|
sectp->ceilingpicnum = RRTILE2004;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == RRTILE1988)
|
|
|
|
sectp->ceilingpicnum = RRTILE2005;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == RRTILE2898)
|
|
|
|
sectp->ceilingpicnum = RRTILE2899;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == RRTILE2878)
|
|
|
|
sectp->ceilingpicnum = RRTILE2879;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == RRTILE2123)
|
|
|
|
sectp->ceilingpicnum = RRTILE2124;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (sectp->ceilingpicnum == RRTILE2125)
|
|
|
|
sectp->ceilingpicnum = RRTILE2126;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
|
|
|
|
2021-11-06 22:05:25 +00:00
|
|
|
if (!sectp->hitag)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-18 16:55:08 +00:00
|
|
|
DukeSectIterator it(sectp);
|
2020-11-02 19:33:44 +00:00
|
|
|
while (auto act1 = it.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-12-01 19:54:41 +00:00
|
|
|
if (iseffector(act1) && (act1->spr.lotag == SE_12_LIGHT_SWITCH || (isRRRA() && (act1->spr.lotag == 47 || act1->spr.lotag == 48))))
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-24 09:53:27 +00:00
|
|
|
DukeStatIterator itr(STAT_EFFECTOR);
|
|
|
|
while (auto act2 = itr.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-21 20:43:41 +00:00
|
|
|
if (act2->spr.hitag == act1->spr.hitag)
|
2020-11-02 19:33:44 +00:00
|
|
|
act2->temp_data[3] = 1;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
j = krand() & 1;
|
2020-11-02 19:33:44 +00:00
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
while (auto act1 = it.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-12-21 20:43:41 +00:00
|
|
|
if (act1->spr.hitag == (sectp->hitag) && act1->spr.lotag == 3)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-11-02 19:33:44 +00:00
|
|
|
act1->temp_data[2] = j;
|
|
|
|
act1->temp_data[4] = 1;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2020-05-10 18:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-01-20 07:31:08 +00:00
|
|
|
void checkhitdefault_r(DDukeActor* targ, DDukeActor* proj)
|
|
|
|
{
|
|
|
|
if ((targ->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && targ->spr.hitag == 0 && targ->spr.lotag == 0 && targ->spr.statnum == 0)
|
|
|
|
return;
|
|
|
|
|
2022-11-29 12:45:25 +00:00
|
|
|
if ((proj->spr.picnum == SAWBLADE || proj->spr.picnum == FREEZEBLAST || proj->GetOwner() != targ) && targ->spr.statnum != 4)
|
2022-01-20 07:31:08 +00:00
|
|
|
{
|
|
|
|
if (badguy(targ) == 1)
|
|
|
|
{
|
|
|
|
if (proj->spr.picnum == RPG) proj->spr.extra <<= 1;
|
|
|
|
else if (isRRRA() && proj->spr.picnum == RPG2) proj->spr.extra <<= 1;
|
|
|
|
|
|
|
|
if ((targ->spr.picnum != DRONE))
|
|
|
|
if (proj->spr.picnum != FREEZEBLAST)
|
2022-11-29 16:36:01 +00:00
|
|
|
//if (actortype[targ->spr.picnum] == 0)
|
2022-01-20 07:31:08 +00:00
|
|
|
{
|
|
|
|
auto spawned = spawn(proj, JIBS6);
|
|
|
|
if (spawned)
|
|
|
|
{
|
|
|
|
if (proj->spr.pal == 6)
|
|
|
|
spawned->spr.pal = 6;
|
|
|
|
spawned->spr.pos.Z += 4;
|
|
|
|
spawned->vel.X = 1;
|
|
|
|
spawned->spr.scale = DVector2(0.375, 0.375);
|
2022-11-25 12:13:50 +00:00
|
|
|
spawned->spr.Angles.Yaw = DAngle22_5 / 4 - randomAngle(22.5 / 2);
|
2022-01-20 07:31:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Owner = proj->GetOwner();
|
|
|
|
|
2022-11-26 13:48:51 +00:00
|
|
|
if (Owner && Owner->isPlayer() && targ->spr.picnum != DRONE)
|
2022-01-20 07:31:08 +00:00
|
|
|
if (ps[Owner->PlayerIndex()].curr_weapon == SHOTGUN_WEAPON)
|
|
|
|
{
|
2022-11-29 12:06:42 +00:00
|
|
|
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat3"));
|
|
|
|
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat1"));
|
|
|
|
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat2"));
|
|
|
|
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat4"));
|
2022-01-20 07:31:08 +00:00
|
|
|
}
|
|
|
|
|
2022-11-28 09:32:55 +00:00
|
|
|
if (targ->spr.statnum == STAT_ZOMBIEACTOR)
|
2022-01-20 07:31:08 +00:00
|
|
|
{
|
2022-11-28 09:32:55 +00:00
|
|
|
ChangeActorStat(targ, STAT_ACTOR);
|
2022-01-20 07:31:08 +00:00
|
|
|
targ->timetosleep = SLEEPTIME;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (targ->spr.statnum != 2)
|
|
|
|
{
|
2022-11-26 13:48:51 +00:00
|
|
|
if (proj->spr.picnum == FREEZEBLAST && ((targ->isPlayer() && targ->spr.pal == 1) || (gs.freezerhurtowner == 0 && proj->GetOwner() == targ)))
|
2022-01-20 07:31:08 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
targ->attackertype = proj->spr.picnum;
|
|
|
|
targ->hitextra += proj->spr.extra;
|
|
|
|
if (targ->spr.picnum != COW)
|
2022-11-25 12:13:50 +00:00
|
|
|
targ->hitang = proj->spr.Angles.Yaw;
|
2022-01-20 07:31:08 +00:00
|
|
|
targ->SetHitOwner(proj->GetOwner());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (targ->spr.statnum == 10)
|
|
|
|
{
|
|
|
|
auto p = targ->PlayerIndex();
|
|
|
|
if (ps[p].newOwner != nullptr)
|
|
|
|
{
|
|
|
|
ps[p].newOwner = nullptr;
|
2022-11-20 08:03:27 +00:00
|
|
|
ps[p].GetActor()->restorepos();
|
2022-01-20 07:31:08 +00:00
|
|
|
|
2022-11-24 02:20:17 +00:00
|
|
|
updatesector(ps[p].GetActor()->getPosWithOffsetZ(), &ps[p].cursector);
|
2022-01-20 07:31:08 +00:00
|
|
|
|
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
while (auto act = it.Next())
|
|
|
|
{
|
|
|
|
if (actorflag(act, SFLAG2_CAMERA)) act->spr.yint = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
auto Owner = targ->GetHitOwner();
|
2022-11-26 13:48:51 +00:00
|
|
|
if (!Owner || !Owner->isPlayer())
|
2022-01-20 07:31:08 +00:00
|
|
|
if (ud.player_skill >= 3)
|
|
|
|
proj->spr.extra += (proj->spr.extra >> 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-24 05:04:29 +00:00
|
|
|
void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
|
2020-05-10 18:59:38 +00:00
|
|
|
{
|
2022-01-17 23:30:43 +00:00
|
|
|
if (targ->GetClass() != RUNTIME_CLASS(DDukeActor))
|
|
|
|
{
|
|
|
|
CallOnHit(targ, proj);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-21 20:43:41 +00:00
|
|
|
if (isRRRA()) switch (targ->spr.picnum)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-25 09:03:15 +00:00
|
|
|
case IRONWHEELSWITCH:
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2022-12-02 23:42:42 +00:00
|
|
|
if (targ->spr.picnum == PLAYERONWATER)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-10-24 04:28:41 +00:00
|
|
|
targ = targ->GetOwner();
|
2022-12-02 23:42:42 +00:00
|
|
|
if (!targ) return;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2022-12-02 23:42:42 +00:00
|
|
|
checkhitdefault_r(targ, proj);
|
2020-05-10 18:59:38 +00:00
|
|
|
}
|
|
|
|
|
2020-05-10 20:20:49 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void checksectors_r(int snum)
|
|
|
|
{
|
2022-02-07 10:04:19 +00:00
|
|
|
player_struct* p;
|
2021-11-17 23:04:36 +00:00
|
|
|
walltype* hitscanwall;
|
2021-11-26 17:59:28 +00:00
|
|
|
HitInfo near;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
|
|
|
p = &ps[snum];
|
2020-11-02 19:23:30 +00:00
|
|
|
auto pact = p->GetActor();
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-19 07:58:31 +00:00
|
|
|
if (!p->insector()) return;
|
|
|
|
|
2021-11-21 07:56:39 +00:00
|
|
|
switch (p->cursector->lotag)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
case 32767:
|
2021-11-21 07:56:39 +00:00
|
|
|
p->cursector->lotag = 0;
|
2020-05-12 11:43:24 +00:00
|
|
|
FTA(9, p);
|
|
|
|
p->secret_rooms++;
|
2022-11-15 11:03:44 +00:00
|
|
|
SECRET_Trigger(sectindex(p->cursector));
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
|
|
|
case -1:
|
2021-11-21 07:56:39 +00:00
|
|
|
p->cursector->lotag = 0;
|
2020-05-12 11:43:24 +00:00
|
|
|
if (!isRRRA() || !RRRA_ExitedLevel)
|
|
|
|
{
|
2020-07-07 15:56:20 +00:00
|
|
|
setnextmap(false);
|
2020-05-12 11:43:24 +00:00
|
|
|
RRRA_ExitedLevel = 1;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
case -2:
|
2021-11-21 07:56:39 +00:00
|
|
|
p->cursector->lotag = 0;
|
2020-05-12 11:43:24 +00:00
|
|
|
p->timebeforeexit = 26 * 8;
|
2021-11-21 07:56:39 +00:00
|
|
|
p->customexitsound = p->cursector->hitag;
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
|
|
|
default:
|
2021-11-21 07:56:39 +00:00
|
|
|
if (p->cursector->lotag >= 10000)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
if (snum == screenpeek || ud.coop == 1)
|
2021-11-21 07:56:39 +00:00
|
|
|
S_PlayActorSound(p->cursector->lotag - 10000, pact);
|
|
|
|
p->cursector->lotag = 0;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//After this point the the player effects the map with space
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (chatmodeon || p->GetActor()->spr.extra <= 0) return;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2020-08-28 20:51:05 +00:00
|
|
|
if (ud.cashman && PlayerInput(snum, SB_OPEN))
|
2020-11-02 18:53:04 +00:00
|
|
|
fi.lotsofmoney(p->GetActor(), 2);
|
2020-05-12 11:43:24 +00:00
|
|
|
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
if (!(PlayerInput(snum, SB_OPEN)))
|
2020-05-12 11:43:24 +00:00
|
|
|
p->toggle_key_flag = 0;
|
|
|
|
|
|
|
|
else if (!p->toggle_key_flag)
|
|
|
|
{
|
2021-11-26 17:59:28 +00:00
|
|
|
near.hitActor = nullptr;
|
2020-05-12 11:43:24 +00:00
|
|
|
p->toggle_key_flag = 1;
|
2021-11-17 23:04:36 +00:00
|
|
|
hitscanwall = nullptr;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
|
|
|
hitawall(p, &hitscanwall);
|
|
|
|
|
2021-11-17 23:04:36 +00:00
|
|
|
if (hitscanwall != nullptr)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-17 22:40:10 +00:00
|
|
|
if (isRRRA())
|
|
|
|
{
|
2021-11-17 23:04:36 +00:00
|
|
|
if (hitscanwall->overpicnum == MIRROR && snum == screenpeek)
|
2021-11-17 22:40:10 +00:00
|
|
|
if (numplayers == 1)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-17 22:40:10 +00:00
|
|
|
if (S_CheckActorSoundPlaying(pact, 27) == 0 && S_CheckActorSoundPlaying(pact, 28) == 0 && S_CheckActorSoundPlaying(pact, 29) == 0
|
|
|
|
&& S_CheckActorSoundPlaying(pact, 257) == 0 && S_CheckActorSoundPlaying(pact, 258) == 0)
|
|
|
|
{
|
|
|
|
int snd = krand() % 5;
|
|
|
|
if (snd == 0)
|
|
|
|
S_PlayActorSound(27, pact);
|
|
|
|
else if (snd == 1)
|
|
|
|
S_PlayActorSound(28, pact);
|
|
|
|
else if (snd == 2)
|
|
|
|
S_PlayActorSound(29, pact);
|
|
|
|
else if (snd == 3)
|
|
|
|
S_PlayActorSound(257, pact);
|
|
|
|
else if (snd == 4)
|
|
|
|
S_PlayActorSound(258, pact);
|
|
|
|
}
|
|
|
|
return;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2021-11-17 22:40:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-17 23:04:36 +00:00
|
|
|
if (hitscanwall->overpicnum == MIRROR)
|
|
|
|
if (hitscanwall->lotag > 0 && S_CheckActorSoundPlaying(pact, hitscanwall->lotag) == 0 && snum == screenpeek)
|
2021-11-17 22:40:10 +00:00
|
|
|
{
|
2021-11-17 23:04:36 +00:00
|
|
|
S_PlayActorSound(hitscanwall->lotag, pact);
|
2021-11-17 22:40:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-12-18 14:11:21 +00:00
|
|
|
if ((hitscanwall->cstat & CSTAT_WALL_MASKED))
|
2021-11-17 23:04:36 +00:00
|
|
|
if (hitscanwall->lotag)
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (p->OnMotorcycle)
|
|
|
|
{
|
|
|
|
if (p->MotoSpeed < 20)
|
|
|
|
{
|
|
|
|
OffMotorcycle(p);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (p->OnBoat)
|
|
|
|
{
|
|
|
|
if (p->MotoSpeed < 20)
|
|
|
|
{
|
|
|
|
OffBoat(p);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2022-11-25 11:30:40 +00:00
|
|
|
neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->GetActor()->PrevAngles.Yaw, near , 80., NT_Lotag | NT_Hitag);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
if (p->newOwner != nullptr)
|
2022-11-25 11:30:40 +00:00
|
|
|
neartag(p->GetActor()->getPrevPosWithOffsetZ(), p->GetActor()->sector(), p->GetActor()->PrevAngles.Yaw, near, 80., NT_Lotag);
|
2020-05-12 11:43:24 +00:00
|
|
|
else
|
|
|
|
{
|
2022-11-25 11:30:40 +00:00
|
|
|
neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->GetActor()->PrevAngles.Yaw, near, 80., NT_Lotag);
|
2021-11-26 17:59:28 +00:00
|
|
|
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
|
2022-11-25 11:30:40 +00:00
|
|
|
neartag(p->GetActor()->getPosWithOffsetZ().plusZ(8), p->GetActor()->sector(), p->GetActor()->PrevAngles.Yaw, near, 80., NT_Lotag);
|
2021-11-26 17:59:28 +00:00
|
|
|
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
|
2022-11-25 11:30:40 +00:00
|
|
|
neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->GetActor()->PrevAngles.Yaw, near, 80., NT_Lotag);
|
2021-11-26 17:59:28 +00:00
|
|
|
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-25 11:30:40 +00:00
|
|
|
neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->GetActor()->PrevAngles.Yaw, near, 80., NT_Lotag | NT_Hitag);
|
2021-11-26 17:59:28 +00:00
|
|
|
if (near.actor() != nullptr)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-30 13:29:34 +00:00
|
|
|
if (actorflag(near.actor(), SFLAG2_TRIGGERRESPAWN))
|
|
|
|
return;
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
switch (near.actor()->spr.picnum)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
case COW:
|
2021-11-26 17:59:28 +00:00
|
|
|
near.actor()->spriteextra = 1;
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-26 17:59:28 +00:00
|
|
|
near.clearObj();
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-26 17:59:28 +00:00
|
|
|
if (p->newOwner == nullptr && near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
|
2021-11-20 23:33:17 +00:00
|
|
|
if (isanunderoperator(p->GetActor()->sector()->lotag))
|
2021-12-30 15:51:56 +00:00
|
|
|
near.hitSector = p->GetActor()->sector();
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-26 17:59:28 +00:00
|
|
|
if (near.hitSector && (near.hitSector->lotag & 16384))
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
|
|
|
|
2021-11-26 17:59:28 +00:00
|
|
|
if (near.actor() == nullptr && near.hitWall == nullptr)
|
2021-11-21 07:56:39 +00:00
|
|
|
if (p->cursector->lotag == 2)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-10-23 17:33:54 +00:00
|
|
|
DDukeActor* hit;
|
2022-09-13 22:11:16 +00:00
|
|
|
double dist = hitasprite(p->GetActor(), &hit);
|
2021-11-26 17:59:28 +00:00
|
|
|
if (hit) near.hitActor = hit;
|
2022-09-13 22:11:16 +00:00
|
|
|
if (dist > 80) near.hitActor = nullptr;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
|
2021-11-26 17:59:28 +00:00
|
|
|
auto const neartagsprite = near.actor();
|
2020-10-27 06:00:39 +00:00
|
|
|
if (neartagsprite != nullptr)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-17 23:16:53 +00:00
|
|
|
if (fi.checkhitswitch(snum, nullptr, neartagsprite)) return;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2022-11-14 09:22:22 +00:00
|
|
|
if (neartagsprite->GetClass() != RUNTIME_CLASS(DDukeActor))
|
|
|
|
{
|
2022-01-21 00:04:08 +00:00
|
|
|
if (CallOnUse(neartagsprite, p))
|
|
|
|
return;
|
2022-11-14 09:22:22 +00:00
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!PlayerInput(snum, SB_OPEN)) return;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
2021-11-26 17:59:28 +00:00
|
|
|
if (near.hitWall == nullptr && near.hitSector == nullptr && near.actor() == nullptr)
|
2022-09-13 22:05:32 +00:00
|
|
|
if (hits(p->GetActor()) < 32)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
if ((krand() & 255) < 16)
|
2020-11-02 19:23:30 +00:00
|
|
|
S_PlayActorSound(DUKE_SEARCH2, pact);
|
|
|
|
else S_PlayActorSound(DUKE_SEARCH, pact);
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-26 17:59:28 +00:00
|
|
|
if (near.hitWall)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-25 16:29:27 +00:00
|
|
|
if (near.hitWall->lotag > 0 && isadoorwall(near.hitWall->picnum))
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-26 17:59:28 +00:00
|
|
|
if (hitscanwall == near.hitWall || hitscanwall == nullptr)
|
|
|
|
fi.checkhitswitch(snum, near.hitWall, nullptr);
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-26 17:59:28 +00:00
|
|
|
if (near.hitSector && (near.hitSector->lotag & 16384) == 0 && isanearoperator(near.hitSector->lotag))
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-26 17:59:28 +00:00
|
|
|
DukeSectIterator it(near.hitSector);
|
2020-11-02 19:42:20 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-20 11:43:24 +00:00
|
|
|
if (isactivator(act) || ismasterswitch(act))
|
2020-05-12 11:43:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-11-26 17:59:28 +00:00
|
|
|
if (haskey(near.hitSector, snum))
|
|
|
|
operatesectors(near.hitSector, p->GetActor());
|
2020-05-12 11:43:24 +00:00
|
|
|
else
|
|
|
|
{
|
2020-11-07 09:23:31 +00:00
|
|
|
if (neartagsprite && neartagsprite->spriteextra > 3)
|
2020-11-02 19:23:30 +00:00
|
|
|
S_PlayActorSound(99, pact);
|
2020-05-12 11:43:24 +00:00
|
|
|
else
|
2020-11-02 19:23:30 +00:00
|
|
|
S_PlayActorSound(419, pact);
|
2020-05-12 11:43:24 +00:00
|
|
|
FTA(41, p);
|
|
|
|
}
|
|
|
|
}
|
2021-11-20 23:33:17 +00:00
|
|
|
else if ((p->GetActor()->sector()->lotag & 16384) == 0)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-20 23:33:17 +00:00
|
|
|
if (isanunderoperator(p->GetActor()->sector()->lotag))
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-11-21 00:04:16 +00:00
|
|
|
DukeSectIterator it(p->GetActor()->sector());
|
2020-11-02 19:42:20 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-11-20 11:43:24 +00:00
|
|
|
if (isactivator(act) || ismasterswitch(act))
|
2020-11-02 19:42:20 +00:00
|
|
|
return;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2021-11-26 17:59:28 +00:00
|
|
|
if (haskey(near.hitSector, snum))
|
2021-12-30 15:51:56 +00:00
|
|
|
operatesectors(p->GetActor()->sector(), p->GetActor());
|
2020-05-12 11:43:24 +00:00
|
|
|
else
|
|
|
|
{
|
2020-11-07 09:23:31 +00:00
|
|
|
if (neartagsprite && neartagsprite->spriteextra > 3)
|
2020-11-02 19:23:30 +00:00
|
|
|
S_PlayActorSound(99, pact);
|
2020-05-12 11:43:24 +00:00
|
|
|
else
|
2020-11-02 19:23:30 +00:00
|
|
|
S_PlayActorSound(419, pact);
|
2020-05-12 11:43:24 +00:00
|
|
|
FTA(41, p);
|
|
|
|
}
|
|
|
|
}
|
2021-11-26 17:59:28 +00:00
|
|
|
else fi.checkhitswitch(snum, near.hitWall, nullptr);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-10 20:20:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-17 23:42:52 +00:00
|
|
|
void dofurniture(walltype* wlwal, sectortype* sectp, int snum)
|
2020-05-10 20:20:49 +00:00
|
|
|
{
|
2021-11-21 07:42:36 +00:00
|
|
|
assert(wlwal->twoSided());
|
|
|
|
auto nextsect = wlwal->nextSector();
|
2022-01-29 08:29:01 +00:00
|
|
|
|
|
|
|
double movestep = min(sectp->hitag * maptoworld, 1.);
|
|
|
|
if (movestep == 0) movestep = 4 * maptoworld;
|
|
|
|
|
|
|
|
double max_x = INT32_MIN, max_y = INT32_MIN, min_x = INT32_MAX, min_y = INT32_MAX;
|
2022-11-15 14:24:17 +00:00
|
|
|
for (auto& wal : nextsect->walls)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-01-29 08:29:01 +00:00
|
|
|
double x = wal.pos.X;
|
|
|
|
double y = wal.pos.Y;
|
2020-05-12 11:43:24 +00:00
|
|
|
if (x > max_x)
|
|
|
|
max_x = x;
|
|
|
|
if (y > max_y)
|
|
|
|
max_y = y;
|
|
|
|
if (x < min_x)
|
|
|
|
min_x = x;
|
|
|
|
if (y < min_y)
|
|
|
|
min_y = y;
|
|
|
|
}
|
2022-01-29 08:29:01 +00:00
|
|
|
|
|
|
|
double margin = movestep + maptoworld;
|
|
|
|
max_x += margin;
|
|
|
|
max_y += margin;
|
|
|
|
min_x -= margin;
|
|
|
|
min_y -= margin;
|
|
|
|
int pos_ok = 1;
|
|
|
|
if (!inside(max_x, max_y, sectp) ||
|
|
|
|
!inside(max_x, min_y, sectp) ||
|
|
|
|
!inside(min_x, min_y, sectp) ||
|
|
|
|
!inside(min_x, max_y, sectp))
|
|
|
|
pos_ok = 0;
|
2022-01-04 16:12:15 +00:00
|
|
|
|
2022-11-15 14:24:17 +00:00
|
|
|
for (auto& wal : nextsect->walls)
|
2022-01-04 16:12:15 +00:00
|
|
|
{
|
|
|
|
switch (wlwal->lotag)
|
|
|
|
{
|
|
|
|
case 42:
|
|
|
|
case 41:
|
|
|
|
case 40:
|
|
|
|
case 43:
|
|
|
|
vertexscan(&wal, [=](walltype* w)
|
|
|
|
{
|
2022-01-04 23:03:33 +00:00
|
|
|
StartInterpolation(w, wlwal->lotag == 41 || wlwal->lotag == 43 ? Interp_Wall_X : Interp_Wall_Y);
|
2022-01-04 16:12:15 +00:00
|
|
|
});
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-29 08:29:01 +00:00
|
|
|
if (pos_ok)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-11-02 19:23:30 +00:00
|
|
|
if (S_CheckActorSoundPlaying(ps[snum].GetActor(), 389) == 0)
|
|
|
|
S_PlayActorSound(389, ps[snum].GetActor());
|
2022-11-15 14:24:17 +00:00
|
|
|
for(auto& wal : nextsect->walls)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-01-29 08:29:01 +00:00
|
|
|
auto vec = wal.pos;
|
2021-11-17 22:40:10 +00:00
|
|
|
switch (wlwal->lotag)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
case 42:
|
2022-01-29 08:29:01 +00:00
|
|
|
vec.Y += movestep;
|
|
|
|
dragpoint(&wal, vec);
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case 41:
|
2022-01-29 08:29:01 +00:00
|
|
|
vec.X -= movestep;
|
|
|
|
dragpoint(&wal, vec);
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case 40:
|
2022-01-29 08:29:01 +00:00
|
|
|
vec.Y -= movestep;
|
|
|
|
dragpoint(&wal, vec);
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case 43:
|
2022-01-29 08:29:01 +00:00
|
|
|
vec.X += movestep;
|
|
|
|
dragpoint(&wal, vec);
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-30 11:45:56 +00:00
|
|
|
movestep -= 2 * maptoworld;
|
2022-11-15 14:24:17 +00:00
|
|
|
for(auto& wal : nextsect->walls)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2022-01-29 08:29:01 +00:00
|
|
|
auto vec = wal.pos;
|
2021-11-17 22:40:10 +00:00
|
|
|
switch (wlwal->lotag)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
case 42:
|
2022-01-30 11:45:56 +00:00
|
|
|
vec.Y -= movestep;
|
2022-01-29 08:29:01 +00:00
|
|
|
dragpoint(&wal, vec);
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case 41:
|
2022-01-30 11:45:56 +00:00
|
|
|
vec.X += movestep;
|
2022-01-29 08:29:01 +00:00
|
|
|
dragpoint(&wal, vec);
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case 40:
|
2022-01-30 11:45:56 +00:00
|
|
|
vec.Y += movestep;
|
2022-01-29 08:29:01 +00:00
|
|
|
dragpoint(&wal, vec);
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case 43:
|
2022-01-30 11:45:56 +00:00
|
|
|
vec.X -= movestep;
|
2022-01-29 08:29:01 +00:00
|
|
|
dragpoint(&wal, vec);
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-10 20:20:49 +00:00
|
|
|
}
|
|
|
|
|
2020-05-14 07:07:07 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-21 08:08:05 +00:00
|
|
|
void tearitup(sectortype* sect)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-11-02 19:33:44 +00:00
|
|
|
DukeSectIterator it(sect);
|
|
|
|
while (auto act = it.Next())
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (act->spr.picnum == DESTRUCTO)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2021-12-27 22:52:16 +00:00
|
|
|
act->attackertype = SHOTSPARK1;
|
2022-01-23 23:10:25 +00:00
|
|
|
act->hitextra = 1;
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-10 10:42:47 +00:00
|
|
|
END_DUKE_NS
|