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"
|
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
|
|
|
|
|
|
|
|
2021-12-04 18:08:50 +00:00
|
|
|
void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, int a, int smoothratio)
|
2020-05-21 20:40:46 +00:00
|
|
|
{
|
2021-12-04 18:08:50 +00:00
|
|
|
int j, k, p;
|
2020-10-13 19:44:05 +00:00
|
|
|
int l, t1, t3, t4;
|
|
|
|
spritetype* s;
|
|
|
|
tspritetype* t;
|
2021-08-30 06:12:39 +00:00
|
|
|
DDukeActor* h;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
int bg = 0;
|
|
|
|
|
|
|
|
for (j = 0; j < spritesortcnt; j++)
|
|
|
|
{
|
|
|
|
t = &tsprite[j];
|
2021-12-04 18:08:50 +00:00
|
|
|
h = static_cast<DDukeActor*>(t->ownerActor);
|
2021-04-15 17:21:43 +00:00
|
|
|
s = h->s;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
switch (t->picnum)
|
|
|
|
{
|
|
|
|
case BLOODPOOL:
|
|
|
|
case FOOTPRINTS:
|
|
|
|
case FOOTPRINTS2:
|
|
|
|
case FOOTPRINTS3:
|
|
|
|
case FOOTPRINTS4:
|
|
|
|
if (t->shade == 127) continue;
|
|
|
|
break;
|
|
|
|
case CHAIR3:
|
|
|
|
|
|
|
|
k = (((t->ang + 3072 + 128 - a) & 2047) >> 8) & 7;
|
|
|
|
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
|
|
|
t->picnum = s->picnum + k;
|
|
|
|
break;
|
|
|
|
case BLOODSPLAT1:
|
|
|
|
case BLOODSPLAT2:
|
|
|
|
case BLOODSPLAT3:
|
|
|
|
case BLOODSPLAT4:
|
|
|
|
if (t->pal == 6)
|
|
|
|
{
|
|
|
|
t->shade = -127;
|
|
|
|
continue;
|
|
|
|
}
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-10-13 19:44:05 +00:00
|
|
|
case BULLETHOLE:
|
|
|
|
case CRACK1:
|
|
|
|
case CRACK2:
|
|
|
|
case CRACK3:
|
|
|
|
case CRACK4:
|
|
|
|
t->shade = 16;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case RRTILE1947:
|
|
|
|
case RRTILE2859:
|
|
|
|
case RRTILE3774:
|
|
|
|
case RRTILE5088:
|
|
|
|
case RRTILE8094:
|
|
|
|
case RRTILE8096:
|
|
|
|
if (isRRRA()) continue;
|
|
|
|
|
|
|
|
case NEON1:
|
|
|
|
case NEON2:
|
|
|
|
case NEON3:
|
|
|
|
case NEON4:
|
|
|
|
case NEON5:
|
|
|
|
case NEON6:
|
|
|
|
continue;
|
|
|
|
default:
|
2021-12-18 15:45:05 +00:00
|
|
|
if (((t->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) || (badguypic(t->picnum) && t->extra > 0) || t->statnum == STAT_PLAYER)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2021-11-20 16:46:08 +00:00
|
|
|
if (s->sector()->shadedsector == 1 && s->statnum != 1)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
|
|
|
s->shade = 16;
|
|
|
|
t->shade = 16;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-07 11:55:08 +00:00
|
|
|
if (t->insector())
|
2021-12-18 12:14:56 +00:00
|
|
|
t->shade = clamp<int>(t->sector()->ceilingstat & CSTAT_SECTOR_SKY ? s->shade : t->sector()->floorshade, -127, 127);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-11-09 23:05:42 +00:00
|
|
|
//Between drawrooms() and drawmasks() is the perfect time to animate sprites
|
|
|
|
for (j = 0; j < spritesortcnt; j++)
|
|
|
|
{
|
2020-10-13 19:44:05 +00:00
|
|
|
t = &tsprite[j];
|
2021-12-04 18:08:50 +00:00
|
|
|
h = static_cast<DDukeActor*>(t->ownerActor);
|
2021-04-15 17:21:43 +00:00
|
|
|
s = h->s;
|
2020-10-23 15:37:19 +00:00
|
|
|
auto OwnerAc = h->GetOwner();
|
2021-04-15 17:21:43 +00:00
|
|
|
auto Owner = OwnerAc ? OwnerAc->s : nullptr;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
switch (s->picnum)
|
|
|
|
{
|
|
|
|
case SECTOREFFECTOR:
|
|
|
|
if (t->lotag == 27 && ud.recstat == 1)
|
|
|
|
{
|
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
|
|
|
|
t->xrepeat = t->yrepeat = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t->statnum == 99) continue;
|
2020-11-02 23:20:51 +00:00
|
|
|
if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newOwner == nullptr && h->GetOwner())
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2021-10-31 06:52:52 +00:00
|
|
|
t->x -= MulScale(MaxSmoothRatio - smoothratio, ps[s->yvel].pos.x - ps[s->yvel].oposx, 16);
|
|
|
|
t->y -= MulScale(MaxSmoothRatio - smoothratio, ps[s->yvel].pos.y - ps[s->yvel].oposy, 16);
|
|
|
|
t->z = interpolatedvalue(ps[s->yvel].oposz, ps[s->yvel].pos.z, smoothratio);
|
2021-04-15 08:02:16 +00:00
|
|
|
t->z += PHEIGHT_RR;
|
2020-10-13 19:44:05 +00:00
|
|
|
s->xrepeat = 24;
|
|
|
|
s->yrepeat = 17;
|
|
|
|
}
|
|
|
|
else if (s->picnum != CRANEPOLE)
|
|
|
|
{
|
2021-01-05 19:20:55 +00:00
|
|
|
t->pos = s->interpolatedvec3(smoothratio);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 15:46:23 +00:00
|
|
|
auto sectp = s->sector();
|
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
|
|
|
|
|
|
|
switch (s->picnum)
|
|
|
|
{
|
|
|
|
case RESPAWNMARKERRED:
|
|
|
|
case RESPAWNMARKERYELLOW:
|
|
|
|
case RESPAWNMARKERGREEN:
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = 861 + ((PlayClock >> 4) & 13);
|
2020-10-13 19:44:05 +00:00
|
|
|
if (s->picnum == RESPAWNMARKERRED)
|
|
|
|
t->pal = 0;
|
|
|
|
else if (s->picnum == RESPAWNMARKERYELLOW)
|
|
|
|
t->pal = 1;
|
|
|
|
else
|
|
|
|
t->pal = 2;
|
|
|
|
if (ud.marker == 0)
|
|
|
|
t->xrepeat = t->yrepeat = 0;
|
|
|
|
break;
|
|
|
|
case DUKELYINGDEAD:
|
|
|
|
s->xrepeat = 24;
|
|
|
|
s->yrepeat = 17;
|
|
|
|
if (s->extra > 0)
|
|
|
|
t->z += (6 << 8);
|
|
|
|
break;
|
|
|
|
case BLOODPOOL:
|
|
|
|
case FOOTPRINTS:
|
|
|
|
case FOOTPRINTS2:
|
|
|
|
case FOOTPRINTS3:
|
|
|
|
case FOOTPRINTS4:
|
|
|
|
if (t->pal == 6)
|
|
|
|
t->shade = -127;
|
|
|
|
case MONEY:
|
|
|
|
case MONEY + 1:
|
|
|
|
break;
|
|
|
|
case TRIPBOMBSPRITE:
|
|
|
|
continue;
|
|
|
|
case FORCESPHERE:
|
2020-11-03 06:12:11 +00:00
|
|
|
if (t->statnum == STAT_MISC && Owner)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2021-11-07 13:09:55 +00:00
|
|
|
int sqa =
|
2020-10-13 19:44:05 +00:00
|
|
|
getangle(
|
2021-10-31 06:52:52 +00:00
|
|
|
Owner->x - ps[screenpeek].pos.x,
|
|
|
|
Owner->y - ps[screenpeek].pos.y);
|
2021-11-07 13:09:55 +00:00
|
|
|
int sqb =
|
2020-10-13 19:44:05 +00:00
|
|
|
getangle(
|
2020-10-23 18:38:45 +00:00
|
|
|
Owner->x - t->x,
|
|
|
|
Owner->y - t->y);
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
if (abs(getincangle(sqa, sqb)) > 512)
|
2021-04-15 17:21:43 +00:00
|
|
|
if (ldist(Owner, t) < ldist(ps[screenpeek].GetActor()->s, Owner))
|
2020-10-13 19:44:05 +00:00
|
|
|
t->xrepeat = t->yrepeat = 0;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
case BURNING:
|
2020-11-03 06:12:11 +00:00
|
|
|
if (Owner && Owner->statnum == STAT_PLAYER)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2020-10-23 18:38:45 +00:00
|
|
|
if (display_mirror == 0 && Owner->yvel == screenpeek && ps[Owner->yvel].over_shoulder_on == 0)
|
2020-10-13 19:44:05 +00:00
|
|
|
t->xrepeat = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t->ang = getangle(x - t->x, y - t->y);
|
2020-10-23 18:38:45 +00:00
|
|
|
t->x = Owner->x;
|
|
|
|
t->y = Owner->y;
|
2020-11-14 11:05:18 +00:00
|
|
|
t->x += bcos(t->ang, -10);
|
|
|
|
t->y += bsin(t->ang, -10);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ATOMICHEALTH:
|
|
|
|
t->z -= (4 << 8);
|
|
|
|
break;
|
|
|
|
case CRYSTALAMMO:
|
2021-02-18 10:46:36 +00:00
|
|
|
t->shade = bsin(PlayClock << 4, -10);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
case SHRINKSPARK:
|
2020-11-03 06:12:11 +00:00
|
|
|
if (Owner && (Owner->picnum == CHEER || Owner->picnum == CHEERSTAYPUT) && isRRRA())
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = CHEERBLADE + ((PlayClock >> 4) & 3);
|
2020-10-13 19:44:05 +00:00
|
|
|
t->shade = -127;
|
|
|
|
}
|
|
|
|
else
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = SHRINKSPARK + ((PlayClock >> 4) & 7);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
case CHEERBOMB:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = CHEERBOMB + ((PlayClock >> 4) & 3);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else goto default_case;
|
|
|
|
case SPIT:
|
2020-11-03 06:12:11 +00:00
|
|
|
if (isRRRA() && Owner)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2020-10-23 18:38:45 +00:00
|
|
|
if (Owner->picnum == MINION && Owner->pal == 8)
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = RRTILE3500 + ((PlayClock >> 4) % 6);
|
2020-10-23 18:38:45 +00:00
|
|
|
else if (Owner->picnum == MINION && Owner->pal == 19)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = RRTILE5090 + ((PlayClock >> 4) & 3);
|
2020-10-13 19:44:05 +00:00
|
|
|
t->shade = -127;
|
|
|
|
}
|
2020-10-23 18:38:45 +00:00
|
|
|
else if (Owner->picnum == MAMA)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
|
|
|
k = getangle(s->x - x, s->y - y);
|
|
|
|
k = (((s->ang + 3072 + 128 - k) & 2047) >> 8) & 7;
|
|
|
|
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
|
|
|
t->picnum = RRTILE7274 + k;
|
|
|
|
}
|
|
|
|
else
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = SPIT + ((PlayClock >> 4) & 3);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
else
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = SPIT + ((PlayClock >> 4) & 3);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
case EMPTYBIKE:
|
|
|
|
if (!isRRRA()) goto default_case;
|
|
|
|
k = getangle(s->x - x, s->y - y);
|
|
|
|
k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
|
|
|
|
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
|
|
|
t->picnum = EMPTYBIKE + k;
|
|
|
|
break;
|
|
|
|
case EMPTYBOAT:
|
|
|
|
if (!isRRRA()) goto default_case;
|
|
|
|
k = getangle(s->x - x, s->y - y);
|
|
|
|
k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
|
|
|
|
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
|
|
|
t->picnum = EMPTYBOAT + k;
|
|
|
|
break;
|
|
|
|
case RPG:
|
|
|
|
k = getangle(s->x - x, s->y - y);
|
|
|
|
k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
|
|
|
|
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
|
|
|
t->picnum = RPG + k;
|
|
|
|
break;
|
|
|
|
case RPG2:
|
|
|
|
if (!isRRRA()) goto default_case;
|
|
|
|
k = getangle(s->x - x, s->y - y);
|
|
|
|
k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
|
|
|
|
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
|
|
|
t->picnum = RPG2 + k;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RECON:
|
|
|
|
|
|
|
|
k = getangle(s->x - x, s->y - y);
|
2020-10-23 18:38:45 +00:00
|
|
|
if (h->temp_data[0] < 4)
|
2020-10-13 19:44:05 +00:00
|
|
|
k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
|
|
|
|
else k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
if (abs(t3) > 64) k += 7;
|
|
|
|
t->picnum = RECON + k;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case APLAYER:
|
|
|
|
|
|
|
|
p = s->yvel;
|
|
|
|
|
|
|
|
if (t->pal == 1) t->z -= (18 << 8);
|
|
|
|
|
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)
|
|
|
|
{
|
2021-04-11 06:45:19 +00:00
|
|
|
t->x = interpolatedvalue(omyx, myx, smoothratio);
|
|
|
|
t->y = interpolatedvalue(omyy, myy, smoothratio);
|
2021-04-15 08:02:16 +00:00
|
|
|
t->z = interpolatedvalue(omyz, myz, smoothratio) + PHEIGHT_RR;
|
2021-04-11 06:45:19 +00:00
|
|
|
t->ang = interpolatedangle(omyang, myang, smoothratio).asbuild();
|
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-04-15 17:21:43 +00:00
|
|
|
if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s->extra > 0 && ps[p].curr_weapon > 0)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2021-12-04 18:08:50 +00:00
|
|
|
auto newtspr = &tsprite[spritesortcnt++];
|
|
|
|
newtspr = t;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
newtspr->statnum = 99;
|
|
|
|
|
|
|
|
newtspr->yrepeat = (t->yrepeat >> 3);
|
|
|
|
if (t->yrepeat < 4) t->yrepeat = 4;
|
|
|
|
|
|
|
|
newtspr->shade = t->shade;
|
|
|
|
newtspr->cstat = 0;
|
|
|
|
|
|
|
|
switch (ps[p].curr_weapon)
|
|
|
|
{
|
|
|
|
case PISTOL_WEAPON: newtspr->picnum = FIRSTGUNSPRITE; break;
|
|
|
|
case SHOTGUN_WEAPON: newtspr->picnum = SHOTGUNSPRITE; break;
|
|
|
|
case RIFLEGUN_WEAPON: newtspr->picnum = CHAINGUNSPRITE; break;
|
|
|
|
case CROSSBOW_WEAPON: newtspr->picnum = RPGSPRITE; break;
|
|
|
|
case CHICKEN_WEAPON: newtspr->picnum = RPGSPRITE; break;
|
|
|
|
case THROWINGDYNAMITE_WEAPON:
|
|
|
|
case DYNAMITE_WEAPON: newtspr->picnum = HEAVYHBOMB; break;
|
|
|
|
case POWDERKEG_WEAPON: newtspr->picnum = TRIPBOMBSPRITE; break;
|
|
|
|
case BOWLING_WEAPON: newtspr->picnum = 3437; break;
|
|
|
|
case THROWSAW_WEAPON: newtspr->picnum = SHRINKSPARK; break;
|
|
|
|
case BUZZSAW_WEAPON: newtspr->picnum = SHRINKSPARK; break;
|
|
|
|
case ALIENBLASTER_WEAPON: newtspr->picnum = DEVISTATORSPRITE; break;
|
|
|
|
case TIT_WEAPON: newtspr->picnum = FREEZESPRITE; break;
|
|
|
|
}
|
|
|
|
|
2020-11-02 23:01:35 +00:00
|
|
|
if (h->GetOwner())
|
2021-10-31 06:52:52 +00:00
|
|
|
newtspr->z = ps[p].pos.z - (12 << 8);
|
2020-10-13 19:44:05 +00:00
|
|
|
else newtspr->z = s->z - (51 << 8);
|
|
|
|
if (ps[p].curr_weapon == HANDBOMB_WEAPON)
|
|
|
|
{
|
|
|
|
newtspr->xrepeat = 10;
|
|
|
|
newtspr->yrepeat = 10;
|
|
|
|
}
|
|
|
|
else if (ps[p].OnMotorcycle || ps[p].OnBoat)
|
|
|
|
{
|
|
|
|
newtspr->xrepeat = 0;
|
|
|
|
newtspr->yrepeat = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
newtspr->xrepeat = 16;
|
|
|
|
newtspr->yrepeat = 16;
|
|
|
|
}
|
|
|
|
newtspr->pal = 0;
|
|
|
|
}
|
|
|
|
|
2020-11-02 23:01:35 +00:00
|
|
|
if (!h->GetOwner())
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2020-12-01 22:57:39 +00:00
|
|
|
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
|
|
|
|
{
|
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
|
|
|
|
{
|
2020-10-13 19:44:05 +00:00
|
|
|
k = (((s->ang + 3072 + 128 - a) & 2047) >> 8) & 7;
|
|
|
|
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-11-06 12:47:06 +00:00
|
|
|
if (t->sector()->lotag == 2) k += 1795 - 1405;
|
2020-10-23 18:38:45 +00:00
|
|
|
else if ((h->floorz - s->z) > (64 << 8)) k += 60;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
t->picnum += k;
|
|
|
|
t->pal = ps[p].palookup;
|
|
|
|
|
|
|
|
goto PALONLY;
|
|
|
|
}
|
|
|
|
|
2021-11-06 12:47:06 +00:00
|
|
|
if (ps[p].on_crane == nullptr && (s->sector()->lotag & 0x7ff) != 1)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2020-10-23 15:37:19 +00:00
|
|
|
l = s->z - ps[p].GetActor()->floorz + (3 << 8);
|
2020-10-13 19:44:05 +00:00
|
|
|
if (l > 1024 && s->yrepeat > 32 && s->extra > 0)
|
2021-11-07 11:43:00 +00:00
|
|
|
s->yoffset = (int8_t)(l / (s->yrepeat << 2));
|
2020-10-13 19:44:05 +00:00
|
|
|
else s->yoffset = 0;
|
|
|
|
}
|
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ps[p].newOwner != nullptr)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
t4 = ScriptCode[gs.actorinfo[APLAYER].scriptaddress + 1];
|
2020-10-13 19:44:05 +00:00
|
|
|
t3 = 0;
|
2020-11-29 12:54:58 +00:00
|
|
|
t1 = ScriptCode[gs.actorinfo[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;
|
2020-10-13 19:44:05 +00:00
|
|
|
t->xrepeat = t->yrepeat = 0;
|
|
|
|
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
|
|
|
|
2020-10-23 18:38:45 +00:00
|
|
|
if (t->z > h->floorz && t->xrepeat < 32)
|
|
|
|
t->z = h->floorz;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
if (ps[p].OnMotorcycle && p == screenpeek)
|
|
|
|
{
|
|
|
|
t->picnum = RRTILE7219;
|
|
|
|
t->xrepeat = 18;
|
|
|
|
t->yrepeat = 18;
|
|
|
|
t4 = 0;
|
|
|
|
t3 = 0;
|
|
|
|
t1 = 0;
|
|
|
|
}
|
|
|
|
else if (ps[p].OnMotorcycle)
|
|
|
|
{
|
|
|
|
k = (((s->ang + 3072 + 128 - a) & 2047) / 170);
|
|
|
|
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
|
|
|
|
|
|
|
t->picnum = RRTILE7213 + k;
|
|
|
|
t->xrepeat = 18;
|
|
|
|
t->yrepeat = 18;
|
|
|
|
t4 = 0;
|
|
|
|
t3 = 0;
|
|
|
|
t1 = 0;
|
|
|
|
}
|
|
|
|
else if (ps[p].OnBoat && p == screenpeek)
|
|
|
|
{
|
|
|
|
t->picnum = RRTILE7190;
|
|
|
|
t->xrepeat = 32;
|
|
|
|
t->yrepeat = 32;
|
|
|
|
t4 = 0;
|
|
|
|
t3 = 0;
|
|
|
|
t1 = 0;
|
|
|
|
}
|
|
|
|
else if (ps[p].OnBoat)
|
|
|
|
{
|
|
|
|
k = (((s->ang + 3072 + 128 - a) & 2047) / 170);
|
|
|
|
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
|
|
|
|
|
|
|
t->picnum = RRTILE7184 + k;
|
|
|
|
t->xrepeat = 32;
|
|
|
|
t->yrepeat = 32;
|
|
|
|
t4 = 0;
|
|
|
|
t3 = 0;
|
|
|
|
t1 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RRTILE2460:
|
|
|
|
case RRTILE2465:
|
|
|
|
case BIKEJIBA:
|
|
|
|
case BIKEJIBB:
|
|
|
|
case BIKEJIBC:
|
|
|
|
case BIKERJIBA:
|
|
|
|
case BIKERJIBB:
|
|
|
|
case BIKERJIBC:
|
|
|
|
case BIKERJIBD:
|
|
|
|
case CHEERJIBA:
|
|
|
|
case CHEERJIBB:
|
|
|
|
case CHEERJIBC:
|
|
|
|
case CHEERJIBD:
|
|
|
|
case FBOATJIBA:
|
|
|
|
case FBOATJIBB:
|
|
|
|
case RABBITJIBA:
|
|
|
|
case RABBITJIBB:
|
|
|
|
case RABBITJIBC:
|
|
|
|
case MAMAJIBA:
|
|
|
|
case MAMAJIBB:
|
|
|
|
if (isRRRA()) goto stuff;
|
|
|
|
else goto default_case;
|
|
|
|
|
|
|
|
case MINJIBA:
|
|
|
|
case MINJIBB:
|
|
|
|
case MINJIBC:
|
|
|
|
if (isRRRA() && t->pal == 19)
|
|
|
|
t->shade = -127;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-10-13 19:44:05 +00:00
|
|
|
case JIBS1:
|
|
|
|
case JIBS2:
|
|
|
|
case JIBS3:
|
|
|
|
case JIBS4:
|
|
|
|
case JIBS5:
|
|
|
|
case JIBS6:
|
|
|
|
case DUKEGUN:
|
|
|
|
case DUKETORSO:
|
|
|
|
case DUKELEG:
|
|
|
|
case BILLYJIBA:
|
|
|
|
case BILLYJIBB:
|
|
|
|
case HULKJIBA:
|
|
|
|
case HULKJIBB:
|
|
|
|
case HULKJIBC:
|
|
|
|
case COOTJIBA:
|
|
|
|
case COOTJIBB:
|
|
|
|
case COOTJIBC:
|
|
|
|
stuff:
|
|
|
|
if (t->pal == 6) t->shade = -120;
|
|
|
|
|
2021-11-20 16:46:08 +00:00
|
|
|
if (s->sector()->shadedsector == 1)
|
2020-10-13 19:44:05 +00:00
|
|
|
t->shade = 16;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
case SCRAP1:
|
|
|
|
case SCRAP2:
|
|
|
|
case SCRAP3:
|
|
|
|
case SCRAP4:
|
|
|
|
case SCRAP5:
|
|
|
|
case SCRAP6:
|
|
|
|
case SCRAP6 + 1:
|
|
|
|
case SCRAP6 + 2:
|
|
|
|
case SCRAP6 + 3:
|
|
|
|
case SCRAP6 + 4:
|
|
|
|
case SCRAP6 + 5:
|
|
|
|
case SCRAP6 + 6:
|
|
|
|
case SCRAP6 + 7:
|
|
|
|
|
|
|
|
if (t->picnum == SCRAP1 && s->yvel >= 0)
|
|
|
|
t->picnum = s->yvel;
|
2020-10-23 18:38:45 +00:00
|
|
|
else t->picnum += h->temp_data[0];
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2021-11-07 15:46:23 +00:00
|
|
|
if (sectp->floorpal)
|
|
|
|
copyfloorpal(t, sectp);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WATERBUBBLE:
|
2021-11-06 12:47:06 +00:00
|
|
|
if (t->sector()->floorpicnum == FLOORSLIME)
|
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:
|
|
|
|
default_case:
|
|
|
|
|
2021-11-07 15:46:23 +00:00
|
|
|
if (sectp->floorpal)
|
|
|
|
copyfloorpal(t, sectp);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-12-18 15:45:05 +00:00
|
|
|
if (gs.actorinfo[s->picnum].scriptaddress && (t->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_SLAB)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
|
|
|
if (t4)
|
|
|
|
{
|
|
|
|
l = ScriptCode[t4 + 2];
|
2020-05-21 20:40:46 +00:00
|
|
|
|
2020-12-01 22:57:39 +00:00
|
|
|
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
|
|
|
|
{
|
2020-05-21 20:40:46 +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 switch (l)
|
|
|
|
{
|
2020-10-13 19:44:05 +00:00
|
|
|
case 2:
|
|
|
|
k = (((s->ang + 3072 + 128 - a) & 2047) >> 8) & 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
k = (((s->ang + 3072 + 128 - a) & 2047) >> 7) & 7;
|
|
|
|
if (k > 3)
|
|
|
|
{
|
2021-12-18 15:02:15 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
k = 7 - k;
|
|
|
|
}
|
2021-12-18 16:00:22 +00:00
|
|
|
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
k = getangle(s->x - x, s->y - y);
|
|
|
|
k = (((s->ang + 3072 + 128 - k) & 2047) >> 8) & 7;
|
|
|
|
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
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
k = getangle(s->x - x, s->y - y);
|
|
|
|
k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
|
|
|
|
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
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
k = (((s->ang + 3072 + 128 - a) & 2047) >> 8) & 7;
|
2021-12-18 16:00:22 +00:00
|
|
|
t->cstat &= ~CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
bg = badguy(s);
|
|
|
|
if (bg && s->statnum == 2 && s->extra > 0)
|
|
|
|
{
|
|
|
|
k = getangle(s->x - x, s->y - y);
|
|
|
|
k = (((s->ang + 3072 + 128 - k) & 2047) >> 8) & 7;
|
|
|
|
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
|
|
|
break;
|
|
|
|
}
|
|
|
|
k = 0;
|
|
|
|
bg = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
t->picnum += k + ScriptCode[t4] + l * t3;
|
|
|
|
|
|
|
|
if (l > 0)
|
2021-12-11 08:56:28 +00:00
|
|
|
{
|
|
|
|
while (t->picnum >= 0 && t->picnum < MAXTILES && !tileGetTexture(t->picnum)->isValid())
|
2020-10-13 19:44:05 +00:00
|
|
|
t->picnum -= l; //Hack, for actors
|
2021-12-11 08:56:28 +00:00
|
|
|
}
|
|
|
|
|
2020-11-22 17:46:20 +00:00
|
|
|
if (t->picnum < 0 || t->picnum >= MAXTILES)
|
|
|
|
{
|
|
|
|
t->picnum = 0;
|
|
|
|
t->xrepeat = t->yrepeat = 0;
|
|
|
|
}
|
2020-10-13 19:44:05 +00:00
|
|
|
|
2020-10-23 18:38:45 +00:00
|
|
|
if (h->dispicnum >= 0)
|
|
|
|
h->dispicnum = t->picnum;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
else if (display_mirror == 1)
|
2021-12-18 15:02:15 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_XFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!isRRRA() && s->picnum == SBMOVE)
|
|
|
|
t->shade = -127;
|
|
|
|
|
2020-11-02 23:01:35 +00:00
|
|
|
if (s->statnum == 13 || badguy(s) || (s->picnum == APLAYER && h->GetOwner()))
|
2021-12-18 15:45:05 +00:00
|
|
|
if ((s->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0 && t->statnum != 99)
|
2020-10-13 19:44:05 +00:00
|
|
|
if (s->picnum != EXPLOSION2 && s->picnum != DOMELITE && s->picnum != TORNADO && s->picnum != EXPLOSION3 && (s->picnum != SBMOVE || isRRRA()))
|
|
|
|
{
|
2020-10-23 18:38:45 +00:00
|
|
|
if (h->dispicnum < 0)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2020-10-23 18:38:45 +00:00
|
|
|
h->dispicnum++;
|
2020-10-13 19:44:05 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (r_shadows && spritesortcnt < (MAXSPRITESONSCREEN - 2))
|
|
|
|
{
|
|
|
|
int daz;
|
|
|
|
|
2021-11-07 15:46:23 +00:00
|
|
|
if (isRRRA() && sectp->lotag == 160) continue;
|
|
|
|
if ((sectp->lotag & 0xff) > 2 || s->statnum == 4 || s->statnum == 5 || s->picnum == DRONE)
|
|
|
|
daz = sectp->floorz;
|
2020-10-13 19:44:05 +00:00
|
|
|
else
|
2020-10-23 18:38:45 +00:00
|
|
|
daz = h->floorz;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
if ((s->z - daz) < (8 << 8))
|
2021-10-31 06:52:52 +00:00
|
|
|
if (ps[screenpeek].pos.z < daz)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2021-12-04 18:08:50 +00:00
|
|
|
auto shadowspr = &tsprite[spritesortcnt++];
|
2020-10-13 19:44:05 +00:00
|
|
|
*shadowspr = *t;
|
|
|
|
|
|
|
|
shadowspr->statnum = 99;
|
|
|
|
|
|
|
|
shadowspr->yrepeat = (t->yrepeat >> 3);
|
|
|
|
if (t->yrepeat < 4) t->yrepeat = 4;
|
|
|
|
shadowspr->shade = 127;
|
2021-12-18 15:02:15 +00:00
|
|
|
shadowspr->cstat |= CSTAT_SPRITE_TRANSLUCENT;
|
2020-10-13 19:44:05 +00:00
|
|
|
|
|
|
|
shadowspr->z = daz;
|
|
|
|
shadowspr->pal = 4;
|
|
|
|
|
2020-12-01 22:57:39 +00:00
|
|
|
if (hw_models && md_tilehasmodel(t->picnum, t->pal) >= 0)
|
|
|
|
{
|
|
|
|
shadowspr->yrepeat = 0;
|
|
|
|
// 512:trans reverse
|
|
|
|
//1024:tell MD2SPRITE.C to use Z-buffer hacks to hide overdraw issues
|
|
|
|
shadowspr->clipdist |= TSPR_FLAGS_MDHACK;
|
2021-12-18 16:00:22 +00:00
|
|
|
shadowspr->cstat |= CSTAT_SPRITE_TRANS_FLIP;
|
2020-12-01 22:57:39 +00:00
|
|
|
}
|
|
|
|
else
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2020-12-01 22:57:39 +00:00
|
|
|
// Alter the shadow's position so that it appears behind the sprite itself.
|
2021-10-31 06:52:52 +00:00
|
|
|
int look = getangle(shadowspr->x - ps[screenpeek].pos.x, shadowspr->y - ps[screenpeek].pos.y);
|
2020-12-01 22:57:39 +00:00
|
|
|
shadowspr->x += bcos(look, -9);
|
|
|
|
shadowspr->y += bsin(look, -9);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (s->picnum)
|
|
|
|
{
|
|
|
|
case RPG2:
|
|
|
|
case RRTILE1790:
|
|
|
|
if (!isRRRA()) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-10-13 19:44:05 +00:00
|
|
|
case EXPLOSION2:
|
|
|
|
case FREEZEBLAST:
|
|
|
|
case ATOMICHEALTH:
|
|
|
|
case FIRELASER:
|
|
|
|
case SHRINKSPARK:
|
|
|
|
case CHAINGUN:
|
|
|
|
case RPG:
|
|
|
|
case EXPLOSION3:
|
|
|
|
case COOLEXPLOSION1:
|
|
|
|
case OWHIP:
|
|
|
|
case UWHIP:
|
|
|
|
if (t->picnum == EXPLOSION2)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
else if (t->picnum == FIRELASER)
|
|
|
|
{
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = FIRELASER + ((PlayClock >> 2) & 5);
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
t->shade = -127;
|
|
|
|
break;
|
|
|
|
case UFOBEAM:
|
|
|
|
case RRTILE3586:
|
2021-06-08 22:31:18 +00:00
|
|
|
case LADDER:
|
2021-12-18 15:02:15 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_INVISIBLE;
|
|
|
|
s->cstat |= CSTAT_SPRITE_INVISIBLE;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
case DESTRUCTO:
|
2021-12-18 15:02:15 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_INVISIBLE;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
case FIRE:
|
|
|
|
case BURNING:
|
2020-11-03 06:12:11 +00:00
|
|
|
if (Owner && Owner->picnum != TREE1 && Owner->picnum != TREE2)
|
2021-11-06 12:47:06 +00:00
|
|
|
t->z = t->sector()->floorz;
|
2020-10-13 19:44:05 +00:00
|
|
|
t->shade = -127;
|
|
|
|
break;
|
|
|
|
case WALLLIGHT3:
|
|
|
|
case WALLLIGHT1:
|
|
|
|
case RRTILE3668:
|
|
|
|
case RRTILE3795:
|
|
|
|
case RRTILE5035:
|
|
|
|
case RRTILE7505:
|
|
|
|
case RRTILE7506:
|
|
|
|
case RRTILE7533:
|
|
|
|
case RRTILE8216:
|
|
|
|
case RRTILE8218:
|
|
|
|
case RRTILE8220:
|
|
|
|
if (!isRRRA()) break;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-10-13 19:44:05 +00:00
|
|
|
case RRTILE1878:
|
|
|
|
case RRTILE1952:
|
|
|
|
case RRTILE1953:
|
|
|
|
case RRTILE1990:
|
|
|
|
case RRTILE2050:
|
|
|
|
case RRTILE2056:
|
|
|
|
case RRTILE2072:
|
|
|
|
case RRTILE2075:
|
|
|
|
case RRTILE2083:
|
|
|
|
case RRTILE2097:
|
|
|
|
case RRTILE2156:
|
|
|
|
case RRTILE2157:
|
|
|
|
case RRTILE2158:
|
|
|
|
case RRTILE2159:
|
|
|
|
case RRTILE2160:
|
|
|
|
case RRTILE2161:
|
|
|
|
case RRTILE2175:
|
|
|
|
case RRTILE2176:
|
|
|
|
case RRTILE2357:
|
|
|
|
case RRTILE2564:
|
|
|
|
case RRTILE2573:
|
|
|
|
case RRTILE2574:
|
|
|
|
case RRTILE2583:
|
|
|
|
case RRTILE2604:
|
|
|
|
case RRTILE2689:
|
|
|
|
case RRTILE2893:
|
|
|
|
case RRTILE2894:
|
|
|
|
case RRTILE2915:
|
|
|
|
case RRTILE2945:
|
|
|
|
case RRTILE2946:
|
|
|
|
case RRTILE2947:
|
|
|
|
case RRTILE2948:
|
|
|
|
case RRTILE2949:
|
|
|
|
case RRTILE2977:
|
|
|
|
case RRTILE2978:
|
|
|
|
case RRTILE3116:
|
|
|
|
case RRTILE3171:
|
|
|
|
case RRTILE3216:
|
|
|
|
case RRTILE3720:
|
|
|
|
t->shade = -127;
|
|
|
|
break;
|
|
|
|
case CHEER:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
if (t->picnum >= CHEER + 102 && t->picnum <= CHEER + 151)
|
|
|
|
t->shade = -127;
|
|
|
|
break;
|
|
|
|
case MINION:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
if (t->pal == 19)
|
|
|
|
t->shade = -127;
|
|
|
|
break;
|
|
|
|
case BIKER:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
if (t->picnum >= BIKER + 54 && t->picnum <= BIKER + 58)
|
|
|
|
t->shade = -127;
|
|
|
|
else if (t->picnum >= BIKER + 84 && t->picnum <= BIKER + 88)
|
|
|
|
t->shade = -127;
|
|
|
|
break;
|
|
|
|
case BILLYRAY:
|
|
|
|
case BILLYRAYSTAYPUT:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
if (t->picnum >= BILLYRAY + 5 && t->picnum <= BILLYRAY + 9)
|
|
|
|
t->shade = -127;
|
|
|
|
break;
|
|
|
|
case RRTILE2034:
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = RRTILE2034 + ((PlayClock >> 2) & 1);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
case RRTILE2944:
|
|
|
|
t->shade = -127;
|
2021-02-18 10:46:36 +00:00
|
|
|
t->picnum = RRTILE2944 + ((PlayClock >> 2) & 4);
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
case PLAYERONWATER:
|
|
|
|
|
|
|
|
k = (((t->ang + 3072 + 128 - a) & 2047) >> 8) & 7;
|
|
|
|
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
|
|
|
|
2020-10-23 18:38:45 +00:00
|
|
|
t->picnum = s->picnum + k + ((h->temp_data[0] < 4) * 5);
|
2020-11-03 06:12:11 +00:00
|
|
|
if (Owner) t->shade = Owner->shade;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
case MUD:
|
|
|
|
t->picnum = MUD + t1;
|
|
|
|
break;
|
|
|
|
case WATERSPLASH2:
|
|
|
|
t->picnum = WATERSPLASH2 + t1;
|
|
|
|
break;
|
|
|
|
case REACTOR2:
|
2020-10-23 18:38:45 +00:00
|
|
|
t->picnum = s->picnum + h->temp_data[2];
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
case SHELL:
|
2020-10-23 18:38:45 +00:00
|
|
|
t->picnum = s->picnum + (h->temp_data[0] & 1);
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-10-13 19:44:05 +00:00
|
|
|
case SHOTGUNSHELL:
|
2021-12-18 16:35:01 +00:00
|
|
|
t->cstat |= CSTAT_SPRITE_XFLIP | CSTAT_SPRITE_YFLIP;
|
2021-12-18 16:00:22 +00:00
|
|
|
if (h->temp_data[0] > 1) t->cstat &= ~CSTAT_SPRITE_XFLIP;
|
2021-12-18 16:35:01 +00:00
|
|
|
if (h->temp_data[0] > 2) t->cstat &= ~CSTAT_SPRITE_XFLIP | CSTAT_SPRITE_YFLIP;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
case FRAMEEFFECT1:
|
2020-11-03 06:12:11 +00:00
|
|
|
if (Owner && Owner->statnum < MAXSTATUS)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2020-10-23 18:38:45 +00:00
|
|
|
if (Owner->picnum == APLAYER)
|
2020-11-02 22:53:55 +00:00
|
|
|
if (ud.cameraactor == nullptr)
|
2020-10-23 18:38:45 +00:00
|
|
|
if (screenpeek == Owner->yvel && display_mirror == 0)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2021-12-04 18:08:50 +00:00
|
|
|
t->ownerActor = nullptr;
|
2020-10-13 19:44:05 +00:00
|
|
|
break;
|
|
|
|
}
|
2021-12-18 15:09:58 +00:00
|
|
|
if ((Owner->cstat & CSTAT_SPRITE_INVISIBLE) == 0)
|
2020-10-13 19:44:05 +00:00
|
|
|
{
|
2020-10-23 18:38:45 +00:00
|
|
|
if (Owner->picnum == APLAYER)
|
2020-10-13 19:44:05 +00:00
|
|
|
t->picnum = 1554;
|
|
|
|
else
|
2020-10-23 15:37:19 +00:00
|
|
|
t->picnum = OwnerAc->dispicnum;
|
2020-10-23 18:38:45 +00:00
|
|
|
t->pal = Owner->pal;
|
|
|
|
t->shade = Owner->shade;
|
|
|
|
t->ang = Owner->ang;
|
2021-12-18 16:35:01 +00:00
|
|
|
t->cstat = CSTAT_SPRITE_TRANSLUCENT | Owner->cstat;
|
2020-10-13 19:44:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CAMERA1:
|
|
|
|
case RAT:
|
|
|
|
k = (((t->ang + 3072 + 128 - a) & 2047) >> 8) & 7;
|
|
|
|
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
|
|
|
t->picnum = s->picnum + k;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-10-23 18:38:45 +00:00
|
|
|
h->dispicnum = t->picnum;
|
2021-11-06 12:47:06 +00:00
|
|
|
if (t->sector()->floorpicnum == MIRROR)
|
2020-10-13 19:44:05 +00:00
|
|
|
t->xrepeat = t->yrepeat = 0;
|
|
|
|
}
|
2020-05-21 20:40:46 +00:00
|
|
|
}
|
|
|
|
END_DUKE_NS
|