2020-05-21 20:40:46 +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-21 20:40:46 +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
|
2020-10-13 19:44:05 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2020-05-21 20:40:46 +00:00
|
|
|
|
|
|
|
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-06 09:39:39 +00:00
|
|
|
#include "prediction.h"
|
2020-11-04 06:01:25 +00:00
|
|
|
#include "dukeactor.h"
|
2021-05-30 21:00:06 +00:00
|
|
|
#include "gamefuncs.h"
|
2022-09-30 14:25:21 +00:00
|
|
|
#include "models/modeldata.h"
|
2020-05-21 20:40:46 +00:00
|
|
|
|
2020-10-13 19:44:05 +00:00
|
|
|
BEGIN_DUKE_NS
|
2020-05-21 20:40:46 +00:00
|
|
|
|
|
|
|
|
2022-09-15 17:06:41 +00:00
|
|
|
void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle viewang, double interpfrac)
|
2020-05-21 20:40:46 +00:00
|
|
|
{
|
2022-08-07 08:25:15 +00:00
|
|
|
int k, p;
|
2022-12-03 19:30:49 +00:00
|
|
|
int t1, t3, t4;
|
2020-10-13 19:44:05 +00:00
|
|
|
tspritetype* t;
|
2021-08-30 06:12:39 +00:00
|
|
|
DDukeActor* h;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
int bg = 0;
|
|
|
|
|
2022-08-07 08:25:15 +00:00
|
|
|
for (unsigned j = 0; j < tsprites.Size(); j++)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-08-07 08:25:15 +00:00
|
|
|
t = tsprites.get(j);
|
2021-12-04 18:08:50 +00:00
|
|
|
h = static_cast<DDukeActor*>(t->ownerActor);
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2022-12-03 12:57:54 +00:00
|
|
|
if (!actorflag(h, SFLAG2_FORCESECTORSHADE) && ((t->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) || (badguypic(t->picnum) && t->extra > 0) || t->statnum == STAT_PLAYER)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-12-03 12:57:54 +00:00
|
|
|
if (h->sector()->shadedsector == 1 && h->spr.statnum != 1)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-12-03 12:57:54 +00:00
|
|
|
t->shade = 16;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
2022-12-03 12:57:54 +00:00
|
|
|
continue;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
2021-12-30 15:24:51 +00:00
|
|
|
if (t->sectp != nullptr)
|
|
|
|
t->shade = clamp<int>(t->sectp->ceilingstat & CSTAT_SECTOR_SKY ? h->spr.shade : t->sectp->floorshade, -127, 127);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-07 08:25:15 +00:00
|
|
|
for (unsigned j = 0; j < tsprites.Size(); j++)
|
2021-11-09 23:05:42 +00:00
|
|
|
{
|
2022-08-07 08:25:15 +00:00
|
|
|
t = tsprites.get(j);
|
2021-12-04 18:08:50 +00:00
|
|
|
h = static_cast<DDukeActor*>(t->ownerActor);
|
2020-10-23 15:37:19 +00:00
|
|
|
auto OwnerAc = h->GetOwner();
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2022-12-05 10:27:25 +00:00
|
|
|
if (iseffector(h))
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-09-03 15:51:35 +00:00
|
|
|
if (t->lotag == SE_27_DEMO_CAM && ud.recstat == 1)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = 11 + ((PlayClock >> 3) & 1);
|
2021-12-18 16:00:22 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_YCENTER;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
else
|
2022-10-07 21:52:29 +00:00
|
|
|
t->scale = DVector2(0, 0);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
2022-12-05 10:27:25 +00:00
|
|
|
if (t->statnum == STAT_TEMP) continue;
|
2022-02-06 20:26:17 +00:00
|
|
|
auto pp = &ps[h->PlayerIndex()];
|
2022-11-26 13:48:51 +00:00
|
|
|
if (h->spr.statnum != STAT_ACTOR && h->isPlayer() && pp->newOwner == nullptr && h->GetOwner())
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-11-21 04:08:33 +00:00
|
|
|
t->pos = h->interpolatedpos(interpfrac);
|
2022-12-09 22:41:21 +00:00
|
|
|
t->Angles.Yaw = h->interpolatedyaw(interpfrac);
|
2022-10-07 21:52:29 +00:00
|
|
|
h->spr.scale = DVector2(0.375, 0.265625);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
2022-01-17 23:54:10 +00:00
|
|
|
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-09-07 05:34:55 +00:00
|
|
|
t->pos = h->interpolatedpos(interpfrac);
|
2022-11-25 10:21:14 +00:00
|
|
|
t->Angles.Yaw = h->interpolatedyaw(interpfrac);
|
2022-10-24 08:40:11 +00:00
|
|
|
}
|
|
|
|
|
2022-01-21 00:04:08 +00:00
|
|
|
|
2022-11-14 20:04:07 +00:00
|
|
|
auto sectp = h->sector();
|
2022-12-05 10:27:25 +00:00
|
|
|
bool res = CallAnimate(h, t);
|
|
|
|
// some actors have 4, some 6 rotation frames - in true Build fashion there's no pointers what to do here without flagging it.
|
|
|
|
if (actorflag(h, SFLAG2_ALWAYSROTATE1) || (t->clipdist & TSPR_ROTATE8FRAMES))
|
|
|
|
applyRotation1(h, t, viewang);
|
|
|
|
else if (actorflag(h, SFLAG2_ALWAYSROTATE2) || (t->clipdist & TSPR_ROTATE12FRAMES))
|
|
|
|
applyRotation2(h, t, viewang);
|
|
|
|
if (sectp->floorpal && !actorflag(h, SFLAG2_NOFLOORPAL) && !(t->clipdist & TSPR_NOFLOORPAL))
|
|
|
|
copyfloorpal(t, sectp);
|
|
|
|
|
|
|
|
if (res)
|
2022-01-19 17:52:52 +00:00
|
|
|
{
|
2022-12-05 10:27:25 +00:00
|
|
|
if (h->dispicnum >= 0)
|
|
|
|
h->dispicnum = t->picnum;
|
|
|
|
continue;
|
2022-01-19 17:52:52 +00:00
|
|
|
}
|
|
|
|
|
2020-10-23 18:38:45 +00:00
|
|
|
t1 = h->temp_data[1];
|
|
|
|
t3 = h->temp_data[3];
|
|
|
|
t4 = h->temp_data[4];
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2021-12-21 19:04:37 +00:00
|
|
|
switch (h->spr.picnum)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_DUKELYINGDEAD:
|
2022-10-07 21:52:29 +00:00
|
|
|
h->spr.scale = DVector2(0.375, 0.265625);
|
2021-12-21 19:04:37 +00:00
|
|
|
if (h->spr.extra > 0)
|
2022-08-20 15:59:15 +00:00
|
|
|
t->pos.Z += 6;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_POWDERKEG:
|
2020-10-13 19:44:05 +00:00
|
|
|
continue;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_BURNING:
|
2021-12-21 21:28:13 +00:00
|
|
|
if (OwnerAc && OwnerAc->spr.statnum == STAT_PLAYER)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-09-01 14:42:23 +00:00
|
|
|
if (display_mirror == 0 && OwnerAc->PlayerIndex() == screenpeek && ps[OwnerAc->PlayerIndex()].over_shoulder_on == 0)
|
2022-10-07 21:52:29 +00:00
|
|
|
t->scale = DVector2(0, 0);
|
2020-10-13 19:44:05 +00:00
|
|
|
else
|
|
|
|
{
|
2022-11-25 12:13:50 +00:00
|
|
|
t->Angles.Yaw = (viewVec - t->pos.XY()).Angle();
|
|
|
|
t->pos.XY() = OwnerAc->spr.pos.XY() + t->Angles.Yaw.ToVector();
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_ATOMICHEALTH:
|
2022-02-07 07:47:18 +00:00
|
|
|
t->pos.Z -= 4;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_CRYSTALAMMO:
|
2022-09-15 17:17:27 +00:00
|
|
|
t->shade = int(BobVal(PlayClock << 4) * 16);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_APLAYER:
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2022-09-01 15:26:46 +00:00
|
|
|
p = h->PlayerIndex();
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2022-08-20 15:59:15 +00:00
|
|
|
if (t->pal == 1) t->pos.Z -= 18;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2021-12-18 15:02:15 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_TRANSLUCENT;
|
2021-11-21 07:50:04 +00:00
|
|
|
#if 0 // multiplayer only
|
2020-10-13 19:44:05 +00:00
|
|
|
if (screenpeek == myconnectindex && numplayers >= 2)
|
|
|
|
{
|
2022-09-08 10:47:21 +00:00
|
|
|
t->pos = interpolatedvalue(omypos, mypos, interpfrac).plusZ(gs_playerheight);
|
2022-09-27 03:28:03 +00:00
|
|
|
t->angle = interpolatedvalue(omyang, myang, interpfrac);
|
2021-11-21 08:05:58 +00:00
|
|
|
t->sector = mycursectnum;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
2021-11-21 07:50:04 +00:00
|
|
|
#endif
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->spr.extra > 0 && ps[p].curr_weapon > 0)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-08-07 08:25:15 +00:00
|
|
|
auto newtspr = tsprites.newTSprite();
|
|
|
|
*newtspr = *t;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
newtspr->statnum = 99;
|
|
|
|
|
2022-10-07 21:46:28 +00:00
|
|
|
newtspr->scale.Y = (max(t->scale.Y * 0.125, 0.0625));
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
newtspr->shade = t->shade;
|
|
|
|
newtspr->cstat = 0;
|
|
|
|
|
|
|
|
switch (ps[p].curr_weapon)
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
case PISTOL_WEAPON: newtspr->picnum = RTILE_FIRSTGUNSPRITE; break;
|
|
|
|
case SHOTGUN_WEAPON: newtspr->picnum = RTILE_SHOTGUNSPRITE; break;
|
|
|
|
case RIFLEGUN_WEAPON: newtspr->picnum = RTILE_RIFLEGUNSPRITE; break;
|
|
|
|
case CROSSBOW_WEAPON: newtspr->picnum = RTILE_CROSSBOWSPRITE; break;
|
|
|
|
case CHICKEN_WEAPON: newtspr->picnum = RTILE_CROSSBOWSPRITE; break;
|
2020-10-13 19:44:05 +00:00
|
|
|
case THROWINGDYNAMITE_WEAPON:
|
2022-12-04 13:16:44 +00:00
|
|
|
case DYNAMITE_WEAPON: newtspr->picnum = RTILE_DYNAMITE; break;
|
|
|
|
case POWDERKEG_WEAPON: newtspr->picnum = RTILE_POWDERKEG; break;
|
|
|
|
case BOWLING_WEAPON: newtspr->picnum = RTILE_BOWLINGBALLSPRITE; break;
|
|
|
|
case THROWSAW_WEAPON: newtspr->picnum = RTILE_RIPSAWSPRITE; break;
|
|
|
|
case BUZZSAW_WEAPON: newtspr->picnum = RTILE_RIPSAWSPRITE; break;
|
|
|
|
case ALIENBLASTER_WEAPON: newtspr->picnum = RTILE_ALIENBLASTERSPRITE; break;
|
|
|
|
case TIT_WEAPON: newtspr->picnum = RTILE_TITSPRITE; break;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
2022-11-21 04:20:08 +00:00
|
|
|
if (h->GetOwner()) newtspr->pos.Z = ps[p].GetActor()->getOffsetZ() - 12;
|
2022-02-06 20:26:17 +00:00
|
|
|
else newtspr->pos.Z = h->spr.pos.Z - 51;
|
2020-10-13 19:44:05 +00:00
|
|
|
if (ps[p].curr_weapon == HANDBOMB_WEAPON)
|
|
|
|
{
|
2022-10-07 21:52:29 +00:00
|
|
|
newtspr->scale = DVector2(0.15625, 0.15625);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
else if (ps[p].OnMotorcycle || ps[p].OnBoat)
|
|
|
|
{
|
2022-10-07 21:52:29 +00:00
|
|
|
newtspr->scale = DVector2(0, 0);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-10-07 21:52:29 +00:00
|
|
|
newtspr->scale = DVector2(0.25, 0.25);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
newtspr->pal = 0;
|
|
|
|
}
|
|
|
|
|
2020-11-02 23:01:35 +00:00
|
|
|
if (!h->GetOwner())
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-09-30 14:25:21 +00:00
|
|
|
if (hw_models && modelManager.CheckModel(h->spr.picnum, h->spr.pal))
|
2020-12-01 22:57:39 +00:00
|
|
|
{
|
2020-10-13 19:44:05 +00:00
|
|
|
k = 0;
|
2021-12-18 16:00:22 +00:00
|
|
|
t->cstat &= ~CSTAT_SPRITE_XFLIP;
|
2020-12-01 22:57:39 +00:00
|
|
|
} else
|
|
|
|
{
|
2022-12-09 22:41:21 +00:00
|
|
|
k = angletorotation1(t->Angles.Yaw, viewang);
|
2020-10-13 19:44:05 +00:00
|
|
|
if (k > 4)
|
|
|
|
{
|
|
|
|
k = 8 - k;
|
2021-12-18 15:02:15 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
2021-12-18 16:00:22 +00:00
|
|
|
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
2021-12-30 15:58:48 +00:00
|
|
|
if (t->sectp->lotag == 2) k += 1795 - 1405;
|
2022-02-04 00:00:28 +00:00
|
|
|
else if ((h->floorz - h->spr.pos.Z) > 64) k += 60;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
t->picnum += k;
|
|
|
|
t->pal = ps[p].palookup;
|
|
|
|
|
|
|
|
goto PALONLY;
|
|
|
|
}
|
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
if (ps[p].on_crane == nullptr && (h->sector()->lotag & 0x7ff) != 1)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-02-04 00:00:28 +00:00
|
|
|
double v = h->spr.pos.Z - ps[p].GetActor()->floorz + 3;
|
2022-10-07 21:33:37 +00:00
|
|
|
if (v > 4 && h->spr.scale.Y > 0.5 && h->spr.extra > 0)
|
|
|
|
h->spr.yoffset = (int8_t)(v / h->spr.scale.Y);
|
2021-12-21 19:04:37 +00:00
|
|
|
else h->spr.yoffset = 0;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ps[p].newOwner != nullptr)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
t4 = ScriptCode[gs.actorinfo[RTILE_APLAYER].scriptaddress + 1];
|
2020-10-13 19:44:05 +00:00
|
|
|
t3 = 0;
|
2022-12-04 13:16:44 +00:00
|
|
|
t1 = ScriptCode[gs.actorinfo[RTILE_APLAYER].scriptaddress + 2];
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ud.cameraactor == nullptr && ps[p].newOwner == nullptr)
|
2020-11-02 23:01:35 +00:00
|
|
|
if (h->GetOwner() && display_mirror == 0 && ps[p].over_shoulder_on == 0)
|
2020-10-13 19:44:05 +00:00
|
|
|
if (ud.multimode < 2 || (ud.multimode > 1 && p == screenpeek))
|
|
|
|
{
|
2021-12-04 18:08:50 +00:00
|
|
|
t->ownerActor = nullptr;
|
2022-10-07 21:52:29 +00:00
|
|
|
t->scale = DVector2(0, 0);
|
2020-10-13 19:44:05 +00:00
|
|
|
continue;
|
2020-05-21 20:40:46 +00:00
|
|
|
}
|
|
|
|
|
2020-10-13 19:44:05 +00:00
|
|
|
PALONLY:
|
|
|
|
|
2021-11-07 15:46:23 +00:00
|
|
|
if (sectp->floorpal)
|
|
|
|
copyfloorpal(t, sectp);
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2020-11-02 23:01:35 +00:00
|
|
|
if (!h->GetOwner()) continue;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2022-10-07 21:33:37 +00:00
|
|
|
if (t->pos.Z > h->floorz && t->scale.X < 0.5)
|
2022-02-04 00:00:28 +00:00
|
|
|
t->pos.Z = h->floorz;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
if (ps[p].OnMotorcycle && p == screenpeek)
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
t->picnum = RTILE_RRTILE7219;
|
2022-10-07 21:52:29 +00:00
|
|
|
t->scale = DVector2(0.28125, 0.28125);
|
2020-10-13 19:44:05 +00:00
|
|
|
t4 = 0;
|
|
|
|
t3 = 0;
|
|
|
|
t1 = 0;
|
|
|
|
}
|
|
|
|
else if (ps[p].OnMotorcycle)
|
|
|
|
{
|
2022-11-25 12:13:50 +00:00
|
|
|
k = angletorotation2(h->spr.Angles.Yaw, viewang);
|
2020-10-13 19:44:05 +00:00
|
|
|
if (k > 6)
|
|
|
|
{
|
|
|
|
k = 12 - k;
|
2021-12-18 15:02:15 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
2021-12-18 16:00:22 +00:00
|
|
|
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
t->picnum = RTILE_RRTILE7213 + k;
|
2022-10-07 21:52:29 +00:00
|
|
|
t->scale = DVector2(0.28125, 0.28125);
|
2020-10-13 19:44:05 +00:00
|
|
|
t4 = 0;
|
|
|
|
t3 = 0;
|
|
|
|
t1 = 0;
|
|
|
|
}
|
|
|
|
else if (ps[p].OnBoat && p == screenpeek)
|
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
t->picnum = RTILE_RRTILE7190;
|
2022-10-07 21:52:29 +00:00
|
|
|
t->scale = DVector2(0.5, 0.5);
|
2020-10-13 19:44:05 +00:00
|
|
|
t4 = 0;
|
|
|
|
t3 = 0;
|
|
|
|
t1 = 0;
|
|
|
|
}
|
|
|
|
else if (ps[p].OnBoat)
|
|
|
|
{
|
2022-11-25 12:13:50 +00:00
|
|
|
k = angletorotation2(h->spr.Angles.Yaw, viewang);
|
2022-09-13 17:52:59 +00:00
|
|
|
|
2020-10-13 19:44:05 +00:00
|
|
|
if (k > 6)
|
|
|
|
{
|
|
|
|
k = 12 - k;
|
2021-12-18 15:02:15 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
2021-12-18 16:00:22 +00:00
|
|
|
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
t->picnum = RTILE_RRTILE7184 + k;
|
2022-10-07 21:52:29 +00:00
|
|
|
t->scale = DVector2(0.5, 0.5);
|
2020-10-13 19:44:05 +00:00
|
|
|
t4 = 0;
|
|
|
|
t3 = 0;
|
|
|
|
t1 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_WATERBUBBLE:
|
2022-12-08 23:44:48 +00:00
|
|
|
if (tilesurface(t->sectp->floortexture()) == TSURF_SLIME)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
|
|
|
t->pal = 7;
|
|
|
|
break;
|
|
|
|
}
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-10-13 19:44:05 +00:00
|
|
|
default:
|
|
|
|
|
2021-11-07 15:46:23 +00:00
|
|
|
if (sectp->floorpal)
|
|
|
|
copyfloorpal(t, sectp);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-12-03 18:33:13 +00:00
|
|
|
applyanimations(t, h, viewVec, viewang);
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2022-11-26 13:48:51 +00:00
|
|
|
if (h->spr.statnum == STAT_DUMMYPLAYER || badguy(h) || (h->isPlayer() && h->GetOwner()))
|
2022-01-12 23:42:34 +00:00
|
|
|
{
|
2022-12-03 18:10:10 +00:00
|
|
|
drawshadows(tsprites, t, h);
|
2022-01-12 23:42:34 +00:00
|
|
|
}
|
|
|
|
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2021-12-21 19:04:37 +00:00
|
|
|
switch (h->spr.picnum)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_SBMOVE:
|
2022-12-03 18:33:13 +00:00
|
|
|
if (!isRRRA())
|
|
|
|
t->shade = -127;
|
|
|
|
break;
|
|
|
|
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_EXPLOSION2:
|
|
|
|
case RTILE_ATOMICHEALTH:
|
|
|
|
case RTILE_CHAINGUN:
|
|
|
|
case RTILE_EXPLOSION3:
|
|
|
|
if (t->picnum == RTILE_EXPLOSION2)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
|
|
|
ps[screenpeek].visibility = -127;
|
2021-02-18 10:46:36 +00:00
|
|
|
lastvisinc = PlayClock + 32;
|
2020-10-13 19:44:05 +00:00
|
|
|
t->pal = 0;
|
|
|
|
}
|
|
|
|
t->shade = -127;
|
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_UFOBEAM:
|
|
|
|
case RTILE_RRTILE3586:
|
|
|
|
case RTILE_LADDER:
|
2021-12-18 15:02:15 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_INVISIBLE;
|
2021-12-21 19:04:37 +00:00
|
|
|
h->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_DESTRUCTO:
|
2021-12-18 15:02:15 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_INVISIBLE;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_FIRE:
|
|
|
|
case RTILE_BURNING:
|
2022-01-26 23:41:33 +00:00
|
|
|
if (!OwnerAc || !actorflag(OwnerAc, SFLAG_NOFLOORFIRE))
|
2022-12-13 11:01:34 +00:00
|
|
|
t->pos.Z = getflorzofslopeptr(t->sectp, t->pos);
|
2020-10-13 19:44:05 +00:00
|
|
|
t->shade = -127;
|
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_CHEER:
|
2020-10-13 19:44:05 +00:00
|
|
|
if (!isRRRA()) break;
|
2022-12-04 13:16:44 +00:00
|
|
|
if (t->picnum >= RTILE_CHEER + 102 && t->picnum <= RTILE_CHEER + 151)
|
2020-10-13 19:44:05 +00:00
|
|
|
t->shade = -127;
|
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_MINION:
|
2020-10-13 19:44:05 +00:00
|
|
|
if (!isRRRA()) break;
|
|
|
|
if (t->pal == 19)
|
|
|
|
t->shade = -127;
|
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_BIKER:
|
2020-10-13 19:44:05 +00:00
|
|
|
if (!isRRRA()) break;
|
2022-12-04 13:16:44 +00:00
|
|
|
if (t->picnum >= RTILE_BIKER + 54 && t->picnum <= RTILE_BIKER + 58)
|
2020-10-13 19:44:05 +00:00
|
|
|
t->shade = -127;
|
2022-12-04 13:16:44 +00:00
|
|
|
else if (t->picnum >= RTILE_BIKER + 84 && t->picnum <= RTILE_BIKER + 88)
|
2020-10-13 19:44:05 +00:00
|
|
|
t->shade = -127;
|
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_BILLYRAY:
|
|
|
|
case RTILE_BILLYRAYSTAYPUT:
|
2020-10-13 19:44:05 +00:00
|
|
|
if (!isRRRA()) break;
|
2022-12-04 13:16:44 +00:00
|
|
|
if (t->picnum >= RTILE_BILLYRAY + 5 && t->picnum <= RTILE_BILLYRAY + 9)
|
2020-10-13 19:44:05 +00:00
|
|
|
t->shade = -127;
|
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_RRTILE2034:
|
|
|
|
t->picnum = RTILE_RRTILE2034 + ((PlayClock >> 2) & 1);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_RRTILE2944:
|
2020-10-13 19:44:05 +00:00
|
|
|
t->shade = -127;
|
2022-12-04 13:16:44 +00:00
|
|
|
t->picnum = RTILE_RRTILE2944 + ((PlayClock >> 2) & 4);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
2022-12-04 13:16:44 +00:00
|
|
|
case RTILE_PLAYERONWATER:
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2022-11-25 12:13:50 +00:00
|
|
|
k = angletorotation1(t->Angles.Yaw, viewang);
|
2020-10-13 19:44:05 +00:00
|
|
|
if (k > 4)
|
|
|
|
{
|
|
|
|
k = 8 - k;
|
2021-12-18 15:02:15 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
2021-12-18 16:00:22 +00:00
|
|
|
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2021-12-21 19:04:37 +00:00
|
|
|
t->picnum = h->spr.picnum + k + ((h->temp_data[0] < 4) * 5);
|
2021-12-21 21:28:13 +00:00
|
|
|
if (OwnerAc) t->shade = OwnerAc->spr.shade;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-10-23 18:38:45 +00:00
|
|
|
h->dispicnum = t->picnum;
|
2022-12-08 22:09:46 +00:00
|
|
|
if (t->sectp->floortexture() == mirrortex)
|
2022-10-07 21:52:29 +00:00
|
|
|
t->scale = DVector2(0, 0);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
2020-05-21 20:40:46 +00:00
|
|
|
}
|
|
|
|
END_DUKE_NS
|