2020-05-20 20:18:03 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2017-2019 Nuke.YKT
|
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 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
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "ns.h"
|
|
|
|
#include "global.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"
|
2021-04-11 07:59:55 +00:00
|
|
|
#include "precache.h"
|
2020-05-20 20:18:03 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
|
|
|
static inline void tloadtile(int tilenum, int palnum = 0)
|
|
|
|
{
|
|
|
|
markTileForPrecache(tilenum, palnum);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-28 05:30:41 +00:00
|
|
|
static void cachespritenum(spritetype *spr)
|
2020-05-20 20:18:03 +00:00
|
|
|
{
|
2021-11-07 11:53:48 +00:00
|
|
|
int maxc;
|
2021-11-07 13:55:28 +00:00
|
|
|
int j;
|
2020-10-28 05:30:41 +00:00
|
|
|
int pal = spr->pal;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
2020-10-28 05:30:41 +00:00
|
|
|
if (ud.monsters_off && badguy(spr)) return;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
maxc = 1;
|
|
|
|
|
2020-10-28 05:30:41 +00:00
|
|
|
switch (spr->picnum)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
|
|
|
case HYDRENT:
|
|
|
|
tloadtile(BROKEFIREHYDRENT);
|
|
|
|
for (j = TOILETWATER; j < (TOILETWATER + 4); j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
break;
|
|
|
|
case RRTILE2121:
|
|
|
|
case RRTILE2122:
|
2020-10-28 05:30:41 +00:00
|
|
|
tloadtile(spr->picnum, pal);
|
2020-07-20 21:21:27 +00:00
|
|
|
break;
|
|
|
|
case TOILET:
|
|
|
|
tloadtile(TOILETBROKE);
|
|
|
|
for (j = TOILETWATER; j < (TOILETWATER + 4); j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
break;
|
|
|
|
case STALL:
|
|
|
|
tloadtile(STALLBROKE);
|
|
|
|
for (j = TOILETWATER; j < (TOILETWATER + 4); j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
break;
|
|
|
|
case FORCERIPPLE:
|
|
|
|
maxc = 9;
|
|
|
|
break;
|
|
|
|
case RUBBERCAN:
|
|
|
|
maxc = 2;
|
|
|
|
break;
|
|
|
|
case TOILETWATER:
|
|
|
|
maxc = 4;
|
|
|
|
break;
|
|
|
|
case BUBBASTAND:
|
|
|
|
for (j = BUBBASCRATCH; j <= (BUBBASCRATCH + 47); j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
break;
|
|
|
|
case SBSWIPE:
|
|
|
|
if (isRRRA())
|
|
|
|
for (j = SBSWIPE; j <= (SBSWIPE + 29); j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COOT:
|
|
|
|
for (j = COOT; j <= (COOT + 217); j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = COOTJIBA; j < COOTJIBC + 4; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
break;
|
|
|
|
case LTH:
|
|
|
|
maxc = 105;
|
|
|
|
for (j = LTH; j < (LTH + maxc); j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
break;
|
|
|
|
case BILLYRAY:
|
|
|
|
maxc = 144;
|
|
|
|
for (j = BILLYWALK; j < (BILLYWALK + maxc); j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = BILLYJIBA; j <= BILLYJIBB + 4; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
break;
|
|
|
|
case COW:
|
|
|
|
maxc = 56;
|
2020-10-28 05:30:41 +00:00
|
|
|
for (j = spr->picnum; j < (spr->picnum + maxc); j++)
|
2020-07-20 21:21:27 +00:00
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
break;
|
|
|
|
case DOGRUN:
|
|
|
|
for (j = DOGATTACK; j <= DOGATTACK + 35; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = DOGRUN; j <= DOGRUN + 80; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
break;
|
|
|
|
case RABBIT:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
for (j = RABBIT; j <= RABBIT + 54; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = RABBIT + 56; j <= RABBIT + 56 + 49; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = RABBIT + 56; j <= RABBIT + 56 + 49; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BIKERB:
|
|
|
|
case BIKERBV2:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
for (j = BIKERB; j <= BIKERB + 104; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BIKER:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
for (j = BIKER; j <= BIKER + 116; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = BIKER + 150; j <= BIKER + 150 + 104; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CHEER:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
for (j = CHEER; j <= CHEER + 44; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = CHEER + 47; j <= CHEER + 47 + 211; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = CHEER + 262; j <= CHEER + 262 + 72; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CHEERB:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
for (j = CHEERB; j <= CHEERB + 83; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = CHEERB + 157; j <= CHEERB + 157 + 83; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MAMA:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
for (j = MAMA; j <= MAMA + 78; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = MAMA + 80; j <= MAMA + 80 + 7; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = MAMA + 90; j <= MAMA + 90 + 94; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CHEERBOAT:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
tloadtile(CHEERBOAT);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HULKBOAT:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
tloadtile(HULKBOAT);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MINIONBOAT:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
tloadtile(MINIONBOAT);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BILLYPLAY:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
for (j = BILLYPLAY; j <= BILLYPLAY + 2; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COOTPLAY:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
for (j = COOTPLAY; j <= COOTPLAY + 4; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PIG:
|
|
|
|
case PIGSTAYPUT:
|
|
|
|
maxc = 68;
|
|
|
|
break;
|
|
|
|
case TORNADO:
|
|
|
|
maxc = 7;
|
|
|
|
break;
|
|
|
|
case HEN:
|
|
|
|
case HENSTAND:
|
|
|
|
maxc = 34;
|
|
|
|
break;
|
|
|
|
case APLAYER:
|
|
|
|
maxc = 0;
|
|
|
|
if (ud.multimode > 1)
|
|
|
|
{
|
|
|
|
maxc = 5;
|
|
|
|
for (j = APLAYER; j < APLAYER + 220; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = DUKEGUN; j < DUKELEG + 4; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ATOMICHEALTH:
|
|
|
|
maxc = 14;
|
|
|
|
break;
|
|
|
|
case DRONE:
|
|
|
|
maxc = 6;
|
|
|
|
break;
|
|
|
|
case EXPLODINGBARREL:
|
|
|
|
case SEENINE:
|
|
|
|
case OOZFILTER:
|
|
|
|
maxc = 3;
|
|
|
|
break;
|
|
|
|
case NUKEBARREL:
|
|
|
|
case CAMERA1:
|
|
|
|
maxc = 5;
|
|
|
|
break;
|
|
|
|
case VIXEN:
|
|
|
|
maxc = 214;
|
2020-10-28 05:30:41 +00:00
|
|
|
for (j = spr->picnum; j < spr->picnum + maxc; j++)
|
2020-07-20 21:21:27 +00:00
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
break;
|
|
|
|
case SBMOVE:
|
|
|
|
if (!isRRRA())
|
|
|
|
{
|
|
|
|
|
|
|
|
maxc = 54;
|
2020-10-28 05:30:41 +00:00
|
|
|
for (j = spr->picnum; j < spr->picnum + maxc; j++)
|
2020-07-20 21:21:27 +00:00
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 100;
|
|
|
|
for (j = SBMOVE; j < SBMOVE + maxc; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HULK:
|
|
|
|
maxc = 40;
|
2020-10-28 05:30:41 +00:00
|
|
|
for (j = spr->picnum - 41; j < spr->picnum + maxc - 41; j++)
|
2020-07-20 21:21:27 +00:00
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = HULKJIBA; j <= HULKJIBC + 4; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
break;
|
|
|
|
case MINION:
|
|
|
|
maxc = 141;
|
2020-10-28 05:30:41 +00:00
|
|
|
for (j = spr->picnum; j < spr->picnum + maxc; j++)
|
2020-07-20 21:21:27 +00:00
|
|
|
tloadtile(j, pal);
|
|
|
|
for (j = MINJIBA; j <= MINJIBC + 4; j++)
|
|
|
|
tloadtile(j, pal);
|
|
|
|
maxc = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-10-28 05:30:41 +00:00
|
|
|
for (j = spr->picnum; j < (spr->picnum + maxc); j++)
|
2020-07-20 21:21:27 +00:00
|
|
|
tloadtile(j, pal);
|
2020-05-20 20:18:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void cachegoodsprites(void)
|
|
|
|
{
|
2021-11-07 13:55:28 +00:00
|
|
|
int i;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
tloadtile(BOTTOMSTATUSBAR);
|
|
|
|
if (ud.multimode > 1)
|
|
|
|
{
|
|
|
|
tloadtile(FRAGBAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
//tloadtile(VIEWSCREEN);
|
|
|
|
|
|
|
|
for (i = FOOTPRINTS; i < FOOTPRINTS + 3; i++)
|
|
|
|
tloadtile(i);
|
|
|
|
|
|
|
|
for (i = BURNING; i < BURNING + 14; i++)
|
|
|
|
tloadtile(i);
|
|
|
|
|
|
|
|
for (i = FIRSTGUN; i < FIRSTGUN + 10; i++)
|
|
|
|
tloadtile(i);
|
|
|
|
|
|
|
|
for (i = EXPLOSION2; i < EXPLOSION2 + 21; i++)
|
|
|
|
tloadtile(i);
|
|
|
|
|
|
|
|
tloadtile(BULLETHOLE);
|
|
|
|
|
|
|
|
for (i = SHOTGUN; i < SHOTGUN + 8; i++)
|
|
|
|
tloadtile(i);
|
|
|
|
|
|
|
|
tloadtile(FOOTPRINTS);
|
|
|
|
|
|
|
|
for (i = JIBS1; i < (JIBS5 + 5); i++)
|
|
|
|
tloadtile(i);
|
|
|
|
|
|
|
|
for (i = SCRAP1; i < (SCRAP1 + 19); i++)
|
|
|
|
tloadtile(i);
|
|
|
|
|
|
|
|
for (i = SMALLSMOKE; i < (SMALLSMOKE + 4); i++)
|
|
|
|
tloadtile(i);
|
|
|
|
|
2020-05-20 20:18:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-20 20:48:54 +00:00
|
|
|
void cacheit_r(void)
|
2020-05-20 20:18:03 +00:00
|
|
|
{
|
2021-04-28 20:23:48 +00:00
|
|
|
if (!r_precache) return;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
cachegoodsprites();
|
|
|
|
|
2021-11-15 21:44:16 +00:00
|
|
|
for (auto& wal : walls())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-15 21:44:16 +00:00
|
|
|
tloadtile(wal.picnum, wal.pal);
|
|
|
|
if(wal.overpicnum >= 0)
|
|
|
|
tloadtile(wal.overpicnum, wal.pal);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
|
2021-11-15 21:44:16 +00:00
|
|
|
for (auto& sect : sectors())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-15 21:44:16 +00:00
|
|
|
tloadtile(sect.floorpicnum, sect.floorpal);
|
|
|
|
tloadtile(sect.ceilingpicnum, sect.ceilingpal);
|
|
|
|
if (sect.ceilingpicnum == LA)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
|
|
|
tloadtile(LA + 1);
|
|
|
|
tloadtile(LA + 2);
|
|
|
|
}
|
|
|
|
|
2021-11-15 21:44:16 +00:00
|
|
|
DukeSectIterator it(§);
|
2020-10-28 05:30:41 +00:00
|
|
|
while (auto j = it.Next())
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if(j->s->xrepeat != 0 && j->s->yrepeat != 0 && (j->s->cstat&32768) == 0)
|
|
|
|
cachespritenum(j->s);
|
2020-10-28 05:30:41 +00:00
|
|
|
}
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
precacheMarkedTiles();
|
2020-05-20 20:18:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-19 09:41:50 +00:00
|
|
|
void spriteinit_r(int i)
|
|
|
|
{
|
|
|
|
i = initspriteforspawn(i, { CRACK1, CRACK2, CRACK3, CRACK4 });
|
|
|
|
if ((i & 0x1000000)) spawninit_r(nullptr, &hittype[i & 0xffffff]);
|
|
|
|
}
|
|
|
|
|
2020-05-21 09:41:48 +00:00
|
|
|
void prelevel_r(int g)
|
2020-05-20 20:18:03 +00:00
|
|
|
{
|
2020-07-20 21:21:27 +00:00
|
|
|
struct player_struct* p;
|
2021-11-07 15:46:23 +00:00
|
|
|
int i;
|
|
|
|
int j;
|
|
|
|
int lotaglist;
|
2020-07-20 21:21:27 +00:00
|
|
|
short lotags[65];
|
2021-11-14 14:03:50 +00:00
|
|
|
int speed = 0;
|
2020-07-20 21:21:27 +00:00
|
|
|
int dist;
|
2021-11-07 15:46:23 +00:00
|
|
|
int sound;
|
2020-07-20 21:21:27 +00:00
|
|
|
sound = 0;
|
|
|
|
|
|
|
|
prelevel_common(g);
|
|
|
|
p = &ps[screenpeek];
|
|
|
|
|
2021-05-02 12:01:10 +00:00
|
|
|
if (currentLevel->gameflags & LEVEL_RR_CLEARMOONSHINE)
|
|
|
|
ps[myconnectindex].steroids_amount = 0;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
|
|
|
|
for (j = 0; j < MAXSPRITES; j++)
|
|
|
|
{
|
2020-10-28 05:37:17 +00:00
|
|
|
auto spr = &sprite[j];
|
|
|
|
if (spr->pal == 100)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
|
|
|
if (numplayers > 1)
|
|
|
|
deletesprite(j);
|
|
|
|
else
|
2020-10-28 05:37:17 +00:00
|
|
|
spr->pal = 0;
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-10-28 05:37:17 +00:00
|
|
|
else if (spr->pal == 101)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2020-10-28 05:37:17 +00:00
|
|
|
spr->extra = 0;
|
|
|
|
spr->hitag = 1;
|
|
|
|
spr->pal = 0;
|
2020-07-20 21:21:27 +00:00
|
|
|
changespritestat(j, 118);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-18 18:44:26 +00:00
|
|
|
for (auto§ : sectors())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-18 18:44:26 +00:00
|
|
|
auto sectp = §
|
2021-11-06 23:15:26 +00:00
|
|
|
if (sectp->ceilingpicnum == RRTILE2577)
|
2020-07-20 21:21:27 +00:00
|
|
|
thunderon = 1;
|
|
|
|
|
2021-11-06 23:15:26 +00:00
|
|
|
switch (sectp->lotag)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
|
|
|
case 41:
|
2020-10-14 19:16:54 +00:00
|
|
|
{
|
2021-11-18 18:44:26 +00:00
|
|
|
DukeSectIterator it(sectp);
|
2021-11-14 14:03:50 +00:00
|
|
|
dist = 0;
|
2020-10-28 05:37:17 +00:00
|
|
|
while (auto act = it.Next())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto spr = act->s;
|
2020-10-28 05:37:17 +00:00
|
|
|
if (spr->picnum == RRTILE11)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2020-10-28 05:37:17 +00:00
|
|
|
dist = spr->lotag << 4;
|
|
|
|
speed = spr->hitag;
|
|
|
|
deletesprite(act);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-10-28 05:37:17 +00:00
|
|
|
if (spr->picnum == RRTILE38)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2020-10-28 05:37:17 +00:00
|
|
|
sound = spr->lotag;
|
|
|
|
deletesprite(act);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
2021-11-18 18:44:26 +00:00
|
|
|
for(auto& osect : sectors())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-18 18:44:26 +00:00
|
|
|
if (sectp->hitag == osect.hitag && &osect != sectp)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2020-10-18 10:10:46 +00:00
|
|
|
// & 32767 to avoid some ordering issues here.
|
|
|
|
// Other code assumes that the lotag is always a sector effector type and can mask the high bit in.
|
2021-11-18 18:44:26 +00:00
|
|
|
addjaildoor(dist, speed, sectp->hitag, osect.lotag & 32767, sound, &osect);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2020-10-14 19:16:54 +00:00
|
|
|
}
|
2020-07-20 21:21:27 +00:00
|
|
|
case 42:
|
|
|
|
{
|
2021-11-18 18:44:26 +00:00
|
|
|
sectortype* childsectnum = nullptr;
|
2021-11-14 12:33:35 +00:00
|
|
|
dist = 0;
|
2021-11-14 14:03:50 +00:00
|
|
|
speed = 0;
|
2021-11-18 18:44:26 +00:00
|
|
|
DukeSectIterator it(sectp);
|
2020-10-28 05:37:17 +00:00
|
|
|
while (auto act = it.Next())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto sj = act->s;
|
2020-10-14 19:16:54 +00:00
|
|
|
if (sj->picnum == RRTILE64)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2020-10-14 19:16:54 +00:00
|
|
|
dist = sj->lotag << 4;
|
|
|
|
speed = sj->hitag;
|
2021-11-21 08:08:05 +00:00
|
|
|
DukeSpriteIterator itt;
|
|
|
|
while(auto act = itt.Next())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-21 08:08:05 +00:00
|
|
|
auto spr = act->s;
|
2020-11-02 22:53:55 +00:00
|
|
|
if (spr->picnum == RRTILE66)
|
|
|
|
if (spr->lotag == sj->sectnum)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-18 18:44:26 +00:00
|
|
|
childsectnum = spr->sector();
|
2021-11-21 08:08:05 +00:00
|
|
|
deletesprite(act);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-28 05:37:17 +00:00
|
|
|
deletesprite(act);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-10-14 19:16:54 +00:00
|
|
|
if (sj->picnum == RRTILE65)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2020-10-14 19:16:54 +00:00
|
|
|
sound = sj->lotag;
|
2020-10-28 05:37:17 +00:00
|
|
|
deletesprite(act);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
2021-11-18 18:44:26 +00:00
|
|
|
addminecart(dist, speed, sectp, sectp->hitag, sound, childsectnum);
|
2020-07-20 21:21:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto si = ac->s;
|
2020-10-23 18:27:05 +00:00
|
|
|
LoadActor(ac, -1, -1);
|
2020-07-20 21:21:27 +00:00
|
|
|
|
2020-10-14 20:18:10 +00:00
|
|
|
if (si->lotag == -1 && (si->cstat & 16))
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2020-10-14 20:18:10 +00:00
|
|
|
ps[0].exitx = si->x;
|
|
|
|
ps[0].exity = si->y;
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-10-14 20:18:10 +00:00
|
|
|
else switch (si->picnum)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
|
|
|
case NUKEBUTTON:
|
|
|
|
chickenplant = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GPSPEED:
|
2021-11-06 12:47:06 +00:00
|
|
|
si->sector()->extra = si->lotag;
|
2020-11-02 18:13:58 +00:00
|
|
|
deletesprite(ac);
|
2020-07-20 21:21:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CYCLER:
|
|
|
|
if (numcyclers >= MAXCYCLERS)
|
|
|
|
I_Error("Too many cycling sectors.");
|
2021-11-18 19:17:47 +00:00
|
|
|
cyclers[numcyclers].sector = si->sector();
|
2021-11-06 20:53:15 +00:00
|
|
|
cyclers[numcyclers].lotag = si->lotag;
|
|
|
|
cyclers[numcyclers].shade1 = si->shade;
|
|
|
|
cyclers[numcyclers].shade2 = si->sector()->floorshade;
|
|
|
|
cyclers[numcyclers].hitag = si->hitag;
|
|
|
|
cyclers[numcyclers].state = (si->ang == 1536);
|
2020-07-20 21:21:27 +00:00
|
|
|
numcyclers++;
|
2020-11-02 18:13:58 +00:00
|
|
|
deletesprite(ac);
|
2020-07-20 21:21:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RRTILE18:
|
2020-10-28 05:37:17 +00:00
|
|
|
addtorch(si);
|
2020-11-02 18:13:58 +00:00
|
|
|
deletesprite(ac);
|
2020-07-20 21:21:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RRTILE35:
|
2020-10-28 05:37:17 +00:00
|
|
|
addlightning(si);
|
2020-11-02 18:13:58 +00:00
|
|
|
deletesprite(ac);
|
2020-07-20 21:21:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RRTILE68:
|
2021-11-20 16:46:08 +00:00
|
|
|
si->sector()->shadedsector = 1;
|
2020-11-02 18:13:58 +00:00
|
|
|
deletesprite(ac);
|
2020-07-20 21:21:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RRTILE67:
|
2020-10-14 20:18:10 +00:00
|
|
|
si->cstat |= 32768;
|
2020-07-20 21:21:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUNDFX:
|
|
|
|
if (ambientfx >= 64)
|
|
|
|
I_Error("Too many ambient effects");
|
|
|
|
else
|
|
|
|
{
|
2020-10-14 20:18:10 +00:00
|
|
|
ambienthitag[ambientfx] = si->hitag;
|
|
|
|
ambientlotag[ambientfx] = si->lotag;
|
|
|
|
si->ang = ambientfx;
|
2020-07-20 21:21:27 +00:00
|
|
|
ambientfx++;
|
2020-10-14 20:18:10 +00:00
|
|
|
si->lotag = 0;
|
|
|
|
si->hitag = 0;
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < MAXSPRITES; i++)
|
|
|
|
{
|
2020-10-28 05:41:39 +00:00
|
|
|
auto spr = &sprite[i];
|
|
|
|
if (spr->picnum == RRTILE19)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
|
|
|
if (geocnt > 64)
|
|
|
|
I_Error("Too many geometry effects");
|
2020-10-28 05:41:39 +00:00
|
|
|
if (spr->hitag == 0)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-21 08:08:05 +00:00
|
|
|
geosector[geocnt] = spr->sector();
|
2020-07-20 21:21:27 +00:00
|
|
|
for (j = 0; j < MAXSPRITES; j++)
|
|
|
|
{
|
2020-10-28 05:41:39 +00:00
|
|
|
auto spj = &sprite[j];
|
|
|
|
if (spr->lotag == spj->lotag && j != i && spj->picnum == RRTILE19)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2020-10-28 05:41:39 +00:00
|
|
|
if (spj->hitag == 1)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-21 08:08:05 +00:00
|
|
|
geosectorwarp[geocnt] = spj->sector();
|
2020-10-28 05:41:39 +00:00
|
|
|
geox[geocnt] = spr->x - spj->x;
|
|
|
|
geoy[geocnt] = spr->y - spj->y;
|
|
|
|
//geoz[geocnt] = spr->z - spj->z;
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-10-28 05:41:39 +00:00
|
|
|
if (spj->hitag == 2)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-21 08:08:05 +00:00
|
|
|
geosectorwarp2[geocnt] = spj->sector();
|
2020-10-28 05:41:39 +00:00
|
|
|
geox2[geocnt] = spr->x - spj->x;
|
|
|
|
geoy2[geocnt] = spr->y - spj->y;
|
|
|
|
//geoz2[geocnt] = spr->z - spj->z;
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
geocnt++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < MAXSPRITES; i++)
|
|
|
|
{
|
2020-10-28 05:46:40 +00:00
|
|
|
auto spr = &sprite[i];
|
|
|
|
if (spr->statnum < MAXSTATUS)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-19 09:41:50 +00:00
|
|
|
if (spr->picnum == SECTOREFFECTOR && spr->lotag == SE_14_SUBWAY_CAR)
|
2020-07-20 21:21:27 +00:00
|
|
|
continue;
|
2021-11-19 09:41:50 +00:00
|
|
|
spriteinit_r(i);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < MAXSPRITES; i++)
|
|
|
|
{
|
2020-10-28 05:46:40 +00:00
|
|
|
auto spr = &sprite[i];
|
|
|
|
if (spr->statnum < MAXSTATUS)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-19 09:41:50 +00:00
|
|
|
if (spr->picnum == SECTOREFFECTOR && spr->lotag == SE_14_SUBWAY_CAR)
|
|
|
|
spriteinit_r(i);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
2020-10-28 05:46:40 +00:00
|
|
|
if (spr->picnum == RRTILE19)
|
2020-07-20 21:21:27 +00:00
|
|
|
deletesprite(i);
|
2020-10-28 05:46:40 +00:00
|
|
|
if (spr->picnum == RRTILE34)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-20 16:46:08 +00:00
|
|
|
spr->sector()->keyinfo = uint8_t(spr->lotag);
|
2020-07-20 21:21:27 +00:00
|
|
|
deletesprite(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lotaglist = 0;
|
|
|
|
|
2020-10-14 20:18:10 +00:00
|
|
|
it.Reset(STAT_DEFAULT);
|
2020-11-02 18:13:58 +00:00
|
|
|
while (auto ac = it.Next())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto spr = ac->s;
|
2020-10-28 05:46:40 +00:00
|
|
|
switch (spr->picnum)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
|
|
|
case RRTILE8464 + 1:
|
|
|
|
if (!isRRRA()) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-07-20 21:21:27 +00:00
|
|
|
case DIPSWITCH + 1:
|
|
|
|
case DIPSWITCH2 + 1:
|
|
|
|
case PULLSWITCH + 1:
|
|
|
|
case HANDSWITCH + 1:
|
|
|
|
case SLOTDOOR + 1:
|
|
|
|
case LIGHTSWITCH + 1:
|
|
|
|
case SPACELIGHTSWITCH + 1:
|
|
|
|
case SPACEDOORSWITCH + 1:
|
|
|
|
case FRANKENSTINESWITCH + 1:
|
|
|
|
case LIGHTSWITCH2 + 1:
|
|
|
|
case POWERSWITCH1 + 1:
|
|
|
|
case LOCKSWITCH1 + 1:
|
|
|
|
case POWERSWITCH2 + 1:
|
|
|
|
case NUKEBUTTON:
|
|
|
|
case NUKEBUTTON + 1:
|
|
|
|
|
|
|
|
for (j = 0; j < lotaglist; j++)
|
2020-10-28 05:46:40 +00:00
|
|
|
if (spr->lotag == lotags[j])
|
2020-07-20 21:21:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (j == lotaglist)
|
|
|
|
{
|
2020-10-28 05:46:40 +00:00
|
|
|
lotags[lotaglist] = spr->lotag;
|
2020-07-20 21:21:27 +00:00
|
|
|
lotaglist++;
|
|
|
|
if (lotaglist > 64)
|
|
|
|
I_Error("Too many switches (64 max).");
|
|
|
|
|
2020-11-02 22:53:55 +00:00
|
|
|
DukeStatIterator it1(STAT_EFFECTOR);
|
|
|
|
while (auto j = it1.Next())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (j->s->lotag == 12 && j->s->hitag == spr->lotag)
|
2020-11-02 22:53:55 +00:00
|
|
|
j->temp_data[0] = 1;
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mirrorcnt = 0;
|
|
|
|
|
2021-11-17 23:30:37 +00:00
|
|
|
for (auto& wl : walls())
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-17 23:30:37 +00:00
|
|
|
walltype* wal = &wl;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
2021-11-17 23:30:37 +00:00
|
|
|
|
2020-07-20 21:21:27 +00:00
|
|
|
if (wal->overpicnum == MIRROR && (wal->cstat & 32) != 0)
|
|
|
|
{
|
2021-12-07 08:41:18 +00:00
|
|
|
auto sectp = wal->nextSector();
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
if (mirrorcnt > 63)
|
|
|
|
I_Error("Too many mirrors (64 max.)");
|
2021-12-07 08:41:18 +00:00
|
|
|
if (sectp && sectp->ceilingpicnum != MIRROR)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-12-07 08:41:18 +00:00
|
|
|
sectp->ceilingpicnum = MIRROR;
|
|
|
|
sectp->floorpicnum = MIRROR;
|
2021-11-17 23:24:17 +00:00
|
|
|
mirrorwall[mirrorcnt] = wal;
|
2021-12-07 08:41:18 +00:00
|
|
|
mirrorsector[mirrorcnt] = sectp;
|
2020-07-20 21:21:27 +00:00
|
|
|
mirrorcnt++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (numanimwalls >= MAXANIMWALLS)
|
|
|
|
I_Error("Too many 'anim' walls (max 512.)");
|
|
|
|
|
|
|
|
animwall[numanimwalls].tag = 0;
|
2021-11-17 23:30:37 +00:00
|
|
|
animwall[numanimwalls].wall = nullptr;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
switch (wal->overpicnum)
|
|
|
|
{
|
|
|
|
case FANSPRITE:
|
2021-11-11 20:40:20 +00:00
|
|
|
wal->cstat |= 65;
|
2021-11-17 23:30:37 +00:00
|
|
|
animwall[numanimwalls].wall = wal;
|
2020-07-20 21:21:27 +00:00
|
|
|
numanimwalls++;
|
|
|
|
break;
|
|
|
|
case BIGFORCE:
|
2021-11-17 23:30:37 +00:00
|
|
|
animwall[numanimwalls].wall = wal;
|
2020-07-20 21:21:27 +00:00
|
|
|
numanimwalls++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
wal->extra = -1;
|
|
|
|
|
|
|
|
switch (wal->picnum)
|
|
|
|
{
|
|
|
|
case SCREENBREAK6:
|
|
|
|
case SCREENBREAK7:
|
|
|
|
case SCREENBREAK8:
|
|
|
|
for (j = SCREENBREAK6; j <= SCREENBREAK8; j++)
|
|
|
|
tloadtile(j);
|
2021-11-17 23:30:37 +00:00
|
|
|
animwall[numanimwalls].wall = wal;
|
2020-07-20 21:21:27 +00:00
|
|
|
animwall[numanimwalls].tag = -1;
|
|
|
|
numanimwalls++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Invalidate textures in sector behind mirror
|
|
|
|
for (i = 0; i < mirrorcnt; i++)
|
|
|
|
{
|
2021-11-17 23:27:03 +00:00
|
|
|
for (auto& mwal : wallsofsector(mirrorsector[i]))
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-17 23:27:03 +00:00
|
|
|
mwal.picnum = MIRROR;
|
|
|
|
mwal.overpicnum = MIRROR;
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
thunder_brightness = 0;
|
|
|
|
if (!thunderon)
|
|
|
|
{
|
|
|
|
g_visibility = p->visibility;
|
|
|
|
}
|
2020-05-21 09:41:48 +00:00
|
|
|
}
|
|
|
|
|
2020-05-20 20:18:03 +00:00
|
|
|
|
2020-05-21 09:41:48 +00:00
|
|
|
END_DUKE_NS
|