2021-03-21 09:58:11 +00:00
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
|
|
|
void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
|
|
|
|
{
|
|
|
|
int i, j = 0, k = 0;
|
|
|
|
int ok = 0, fofmode = 0;
|
|
|
|
int offx, offy;
|
|
|
|
spritetype* floor1, *floor2 = nullptr;
|
|
|
|
|
|
|
|
if (spr->ang != 512) return;
|
|
|
|
|
2021-11-09 23:05:42 +00:00
|
|
|
i = FOF; //Effect TILE
|
2021-03-21 09:58:11 +00:00
|
|
|
tileDelete(FOF);
|
2021-05-09 07:05:42 +00:00
|
|
|
if (!testgotpic(FOF, true)) return;
|
2021-03-21 09:58:11 +00:00
|
|
|
|
2021-11-11 22:32:49 +00:00
|
|
|
TArray<int> tempsectorz(numsectors, true);
|
|
|
|
TArray<int> tempsectorpicnum(numsectors, true);
|
|
|
|
|
2021-03-21 09:58:11 +00:00
|
|
|
floor1 = spr;
|
|
|
|
|
|
|
|
if (spr->lotag == tag + 2) fofmode = tag + 0;
|
|
|
|
if (spr->lotag == tag + 3) fofmode = tag + 1;
|
|
|
|
if (spr->lotag == tag + 4) fofmode = tag + 0;
|
|
|
|
if (spr->lotag == tag + 5) fofmode = tag + 1;
|
|
|
|
|
|
|
|
ok++;
|
|
|
|
|
|
|
|
DukeStatIterator it(STAT_RAROR);
|
|
|
|
while (auto act = it.Next())
|
|
|
|
{
|
2021-04-15 17:34:03 +00:00
|
|
|
auto spr = act->s;
|
2021-03-21 09:58:11 +00:00
|
|
|
if (
|
|
|
|
spr->picnum == SECTOREFFECTOR &&
|
|
|
|
spr->lotag == fofmode &&
|
|
|
|
spr->hitag == floor1->hitag
|
|
|
|
)
|
|
|
|
{
|
|
|
|
floor1 = spr;
|
|
|
|
fofmode = spr->lotag;
|
|
|
|
ok++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if(ok==1) { Message("no floor1",RED); return; }
|
|
|
|
|
|
|
|
if (fofmode == tag + 0) k = tag + 1; else k = tag + 0;
|
|
|
|
|
|
|
|
it.Reset(STAT_RAROR);
|
|
|
|
while (auto act = it.Next())
|
|
|
|
{
|
2021-04-15 17:34:03 +00:00
|
|
|
auto spr = act->s;
|
2021-03-21 09:58:11 +00:00
|
|
|
if (
|
|
|
|
spr->picnum == SECTOREFFECTOR &&
|
|
|
|
spr->lotag == k &&
|
|
|
|
spr->hitag == floor1->hitag
|
|
|
|
)
|
|
|
|
{
|
|
|
|
floor2 = spr;
|
|
|
|
ok++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if(ok==2) { Message("no floor2",RED); return; }
|
|
|
|
|
|
|
|
it.Reset(STAT_RAROR);
|
|
|
|
while (auto act = it.Next())
|
|
|
|
{
|
2021-04-15 17:34:03 +00:00
|
|
|
auto spr = act->s;
|
2021-03-21 09:58:11 +00:00
|
|
|
if (spr->picnum == SECTOREFFECTOR &&
|
|
|
|
spr->lotag == k + 2 &&
|
|
|
|
spr->hitag == floor1->hitag
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (k == tag + 0)
|
|
|
|
{
|
2021-11-06 12:47:06 +00:00
|
|
|
tempsectorz[spr->sectnum] = spr->sector()->floorz;
|
|
|
|
spr->sector()->floorz += (((z - spr->sector()->floorz) / 32768) + 1) * 32768;
|
|
|
|
tempsectorpicnum[spr->sectnum] = spr->sector()->floorpicnum;
|
|
|
|
spr->sector()->floorpicnum = 13;
|
2021-03-21 09:58:11 +00:00
|
|
|
}
|
|
|
|
if (k == tag + 1)
|
|
|
|
{
|
2021-11-06 12:47:06 +00:00
|
|
|
tempsectorz[spr->sectnum] = spr->sector()->ceilingz;
|
|
|
|
spr->sector()->ceilingz += (((z - spr->sector()->ceilingz) / 32768) - 1) * 32768;
|
|
|
|
tempsectorpicnum[spr->sectnum] = spr->sector()->ceilingpicnum;
|
|
|
|
spr->sector()->ceilingpicnum = 13;
|
2021-03-21 09:58:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
offx = x - floor1->x;
|
|
|
|
offy = y - floor1->y;
|
|
|
|
|
2021-11-08 22:40:57 +00:00
|
|
|
renderDrawRoomsQ16(floor2->x + offx, floor2->y + offy, z, a.asq16(), h.asq16(), floor2->sectnum, false);
|
2021-04-02 08:28:40 +00:00
|
|
|
fi.animatesprites(pm_tsprite, pm_spritesortcnt, offx + floor2->x, offy + floor2->y, a.asbuild(), smoothratio);
|
2021-03-21 09:58:11 +00:00
|
|
|
renderDrawMasks();
|
|
|
|
|
|
|
|
it.Reset(STAT_RAROR);
|
|
|
|
while (auto act = it.Next())
|
|
|
|
{
|
2021-04-15 17:34:03 +00:00
|
|
|
auto spr = act->s;
|
2021-03-21 09:58:11 +00:00
|
|
|
if (spr->picnum == 1 &&
|
|
|
|
spr->lotag == k + 2 &&
|
|
|
|
spr->hitag == floor1->hitag
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (k == tag + 0)
|
|
|
|
{
|
2021-11-06 12:47:06 +00:00
|
|
|
spr->sector()->floorz = tempsectorz[spr->sectnum];
|
|
|
|
spr->sector()->floorpicnum = tempsectorpicnum[spr->sectnum];
|
2021-03-21 09:58:11 +00:00
|
|
|
}
|
|
|
|
if (k == tag + 1)
|
|
|
|
{
|
2021-11-06 12:47:06 +00:00
|
|
|
spr->sector()->ceilingz = tempsectorz[spr->sectnum];
|
|
|
|
spr->sector()->ceilingpicnum = tempsectorpicnum[spr->sectnum];
|
2021-03-21 09:58:11 +00:00
|
|
|
}
|
|
|
|
}// end if
|
|
|
|
}// end for
|
|
|
|
|
|
|
|
} // end SE40
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
|
|
|
|
{
|
|
|
|
int tag;
|
|
|
|
if (!isRR()) tag = 40;
|
|
|
|
else if (isRRRA()) tag = 150;
|
|
|
|
else return;
|
|
|
|
|
|
|
|
DukeStatIterator it(STAT_RAROR);
|
|
|
|
while (auto act = it.Next())
|
|
|
|
{
|
2021-04-15 17:34:03 +00:00
|
|
|
switch (act->s->lotag - tag + 40)
|
2021-03-21 09:58:11 +00:00
|
|
|
{
|
2021-11-09 23:05:42 +00:00
|
|
|
//case 40:
|
|
|
|
//case 41:
|
|
|
|
// SE40_Draw(i,x,y,a,smoothratio);
|
|
|
|
// break;
|
2021-03-21 09:58:11 +00:00
|
|
|
case 42:
|
|
|
|
case 43:
|
|
|
|
case 44:
|
|
|
|
case 45:
|
2021-04-15 17:34:03 +00:00
|
|
|
if (ps[screenpeek].cursectnum == act->s->sectnum)
|
|
|
|
SE40_Draw(tag, act->s, x, y, z, a, h, smoothratio);
|
2021-03-21 09:58:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// split out so it can also be applied to camera views
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz choriz, int smoothratio)
|
|
|
|
{
|
2021-05-09 07:05:42 +00:00
|
|
|
if (testgotpic(TILE_MIRROR, true))
|
2021-03-21 09:58:11 +00:00
|
|
|
{
|
|
|
|
int dst = 0x7fffffff, i = 0;
|
|
|
|
for (int k = 0; k < mirrorcnt; k++)
|
|
|
|
{
|
|
|
|
int j = abs(wall[mirrorwall[k]].x - cposx) + abs(wall[mirrorwall[k]].y - cposy);
|
|
|
|
if (j < dst) dst = j, i = k;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wall[mirrorwall[i]].overpicnum == TILE_MIRROR)
|
|
|
|
{
|
|
|
|
int tposx, tposy;
|
|
|
|
fixed_t tang;
|
|
|
|
|
|
|
|
renderPrepareMirror(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), mirrorwall[i], &tposx, &tposy, &tang);
|
|
|
|
|
|
|
|
int j = g_visibility;
|
|
|
|
g_visibility = (j >> 1) + (j >> 2);
|
|
|
|
|
2021-11-08 22:40:57 +00:00
|
|
|
renderDrawRoomsQ16(tposx, tposy, cposz, tang, choriz.asq16(), mirrorsector[i], true);
|
2021-03-21 09:58:11 +00:00
|
|
|
|
|
|
|
display_mirror = 1;
|
2021-04-02 08:28:40 +00:00
|
|
|
fi.animatesprites(pm_tsprite, pm_spritesortcnt, tposx, tposy, tang, smoothratio);
|
2021-03-21 09:58:11 +00:00
|
|
|
display_mirror = 0;
|
|
|
|
|
|
|
|
renderDrawMasks();
|
|
|
|
renderCompleteMirror(); //Reverse screen x-wise in this function
|
|
|
|
g_visibility = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// used by RR to inject some external geometry into a scene.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixedhoriz choriz, int sect, int smoothratio)
|
|
|
|
{
|
2021-11-07 13:55:28 +00:00
|
|
|
int gs, tgsect, geosect, geoid = 0;
|
2021-11-08 22:40:57 +00:00
|
|
|
renderDrawRoomsQ16(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), sect, false);
|
2021-04-02 08:28:40 +00:00
|
|
|
fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio);
|
2021-03-21 09:58:11 +00:00
|
|
|
renderDrawMasks();
|
|
|
|
for (gs = 0; gs < geocnt; gs++)
|
|
|
|
{
|
|
|
|
tgsect = geosector[gs];
|
|
|
|
|
|
|
|
DukeSectIterator it(tgsect);
|
|
|
|
while (auto act = it.Next())
|
|
|
|
{
|
2021-08-27 14:38:53 +00:00
|
|
|
changeactorsect(act, geosectorwarp[gs]);
|
2021-04-15 17:34:03 +00:00
|
|
|
setsprite(act, act->s->x -= geox[gs], act->s->y -= geoy[gs], act->s->z);
|
2021-03-21 09:58:11 +00:00
|
|
|
}
|
|
|
|
if (geosector[gs] == sect)
|
|
|
|
{
|
|
|
|
geosect = geosectorwarp[gs];
|
|
|
|
geoid = gs;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cposx -= geox[geoid];
|
|
|
|
cposy -= geoy[geoid];
|
2021-11-08 22:40:57 +00:00
|
|
|
renderDrawRoomsQ16(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), sect, false);
|
2021-03-21 09:58:11 +00:00
|
|
|
cposx += geox[geoid];
|
|
|
|
cposy += geoy[geoid];
|
|
|
|
for (gs = 0; gs < geocnt; gs++)
|
|
|
|
{
|
|
|
|
tgsect = geosectorwarp[gs];
|
|
|
|
DukeSectIterator it(tgsect);
|
|
|
|
while (auto act = it.Next())
|
|
|
|
{
|
2021-08-27 14:38:53 +00:00
|
|
|
changeactorsect(act, geosector[gs]);
|
2021-04-15 17:34:03 +00:00
|
|
|
setsprite(act, act->s->x += geox[gs], act->s->y += geoy[gs], act->s->z);
|
2021-03-21 09:58:11 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-02 08:28:40 +00:00
|
|
|
fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio);
|
2021-03-21 09:58:11 +00:00
|
|
|
renderDrawMasks();
|
|
|
|
for (gs = 0; gs < geocnt; gs++)
|
|
|
|
{
|
|
|
|
tgsect = geosector[gs];
|
|
|
|
DukeSectIterator it(tgsect);
|
|
|
|
while (auto act = it.Next())
|
|
|
|
{
|
2021-08-27 14:38:53 +00:00
|
|
|
changeactorsect(act, geosectorwarp2[gs]);
|
2021-04-15 17:34:03 +00:00
|
|
|
setsprite(act, act->s->x -= geox2[gs], act->s->y -= geoy2[gs], act->s->z);
|
2021-03-21 09:58:11 +00:00
|
|
|
}
|
|
|
|
if (geosector[gs] == sect)
|
|
|
|
{
|
|
|
|
geosect = geosectorwarp2[gs];
|
|
|
|
geoid = gs;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cposx -= geox2[geoid];
|
|
|
|
cposy -= geoy2[geoid];
|
2021-11-08 22:40:57 +00:00
|
|
|
renderDrawRoomsQ16(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), sect, false);
|
2021-03-21 09:58:11 +00:00
|
|
|
cposx += geox2[geoid];
|
|
|
|
cposy += geoy2[geoid];
|
|
|
|
for (gs = 0; gs < geocnt; gs++)
|
|
|
|
{
|
|
|
|
tgsect = geosectorwarp2[gs];
|
|
|
|
DukeSectIterator it(tgsect);
|
|
|
|
while (auto act = it.Next())
|
|
|
|
{
|
2021-08-27 14:38:53 +00:00
|
|
|
changeactorsect(act, geosector[gs]);
|
2021-04-15 17:34:03 +00:00
|
|
|
setsprite(act, act->s->x += geox2[gs], act->s->y += geoy2[gs], act->s->z);
|
2021-03-21 09:58:11 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-02 08:28:40 +00:00
|
|
|
fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio);
|
2021-03-21 09:58:11 +00:00
|
|
|
renderDrawMasks();
|
|
|
|
}
|
|
|
|
END_DUKE_NS
|