2020-05-20 20:18:03 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements)
|
2020-06-28 07:03:31 +00:00
|
|
|
Copyright (C) 2020 - Christoph Oelckers
|
2020-05-20 20:18:03 +00:00
|
|
|
|
|
|
|
This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition
|
|
|
|
|
|
|
|
Duke Nukem 3D is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Original Source: 1996 - Todd Replogle
|
|
|
|
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|
|
|
|
|
|
|
EDuke enhancements integrated: 04/13/2003 - Matt Saettler
|
|
|
|
|
|
|
|
Note: EDuke source was in transition. Changes are in-progress in the
|
|
|
|
source as it is released.
|
|
|
|
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "ns.h"
|
|
|
|
#include "global.h"
|
|
|
|
#include "build.h"
|
2020-10-21 17:14:41 +00:00
|
|
|
#include "dukeactor.h"
|
2021-04-11 07:59:55 +00:00
|
|
|
#include "precache.h"
|
2020-05-20 20:18:03 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-12-04 12:02:38 +00:00
|
|
|
void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
2020-05-20 20:18:03 +00:00
|
|
|
{
|
2023-10-04 07:11:00 +00:00
|
|
|
unsigned j;
|
2022-12-03 19:30:49 +00:00
|
|
|
TArray<short> lotags;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
prelevel_common(g);
|
|
|
|
|
2020-11-02 18:13:58 +00:00
|
|
|
DukeStatIterator it(STAT_DEFAULT);
|
|
|
|
while (auto ac = it.Next())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2020-10-23 18:27:05 +00:00
|
|
|
LoadActor(ac, -1, -1);
|
2020-07-20 21:21:27 +00:00
|
|
|
|
2021-12-21 19:59:15 +00:00
|
|
|
if (ac->spr.lotag == -1 && (ac->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2023-10-02 02:51:13 +00:00
|
|
|
getPlayer(0)->Exit = ac->spr.pos.XY();
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2022-07-25 22:12:57 +00:00
|
|
|
else
|
|
|
|
premapcontroller(ac);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
|
2020-10-28 05:25:08 +00:00
|
|
|
|
2021-12-04 12:02:38 +00:00
|
|
|
for (auto actor : actors)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-12-04 12:02:38 +00:00
|
|
|
if (actor->exists())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2022-12-01 19:54:41 +00:00
|
|
|
if (iseffector(actor) && actor->spr.lotag == SE_14_SUBWAY_CAR)
|
2020-07-20 21:21:27 +00:00
|
|
|
continue;
|
2022-12-15 09:46:41 +00:00
|
|
|
spriteinit(actor, actors);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-04 12:02:38 +00:00
|
|
|
for (auto actor : actors)
|
2020-10-28 05:25:08 +00:00
|
|
|
{
|
2021-12-04 12:02:38 +00:00
|
|
|
if (actor->exists())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2022-12-01 19:54:41 +00:00
|
|
|
if (iseffector(actor) && actor->spr.lotag == SE_14_SUBWAY_CAR)
|
2022-12-15 09:46:41 +00:00
|
|
|
spriteinit(actor, actors);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-10-28 05:25:08 +00:00
|
|
|
}
|
2020-07-20 21:21:27 +00:00
|
|
|
|
2020-10-14 20:18:10 +00:00
|
|
|
it.Reset(STAT_DEFAULT);
|
2021-12-04 12:02:38 +00:00
|
|
|
while (auto actor = it.Next())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2022-12-10 23:23:38 +00:00
|
|
|
auto ext = GetExtInfo(actor->spr.spritetexture());
|
|
|
|
if (ext.switchphase == 1 && switches[ext.switchindex].type == SwitchDef::Regular)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2022-12-03 19:30:49 +00:00
|
|
|
j = lotags.Find(actor->spr.lotag);
|
|
|
|
if (j == lotags.Size())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2022-12-03 19:30:49 +00:00
|
|
|
lotags.Push(actor->spr.lotag);
|
2020-11-02 18:13:58 +00:00
|
|
|
DukeStatIterator it1(STAT_EFFECTOR);
|
|
|
|
while (auto ac = it1.Next())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2022-12-03 19:20:22 +00:00
|
|
|
if (ac->spr.lotag == SE_12_LIGHT_SWITCH && ac->spr.hitag == actor->spr.lotag)
|
2022-12-22 08:49:42 +00:00
|
|
|
ac->counter = 1;
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-20 20:18:03 +00:00
|
|
|
}
|
|
|
|
|
2021-11-15 21:44:16 +00:00
|
|
|
END_DUKE_NS
|