mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-31 05:20:51 +00:00
Make shadows more consistent on slopes for non-players
This commit is contained in:
parent
9f18164ad4
commit
14fcda0eca
1 changed files with 14 additions and 33 deletions
47
src/p_mobj.c
47
src/p_mobj.c
|
@ -6293,6 +6293,8 @@ void P_RunShadows(void)
|
||||||
|
|
||||||
for (mobj = shadowcap; mobj; mobj = next)
|
for (mobj = shadowcap; mobj; mobj = next)
|
||||||
{
|
{
|
||||||
|
fixed_t floorz;
|
||||||
|
|
||||||
next = mobj->hnext;
|
next = mobj->hnext;
|
||||||
P_SetTarget(&mobj->hnext, NULL);
|
P_SetTarget(&mobj->hnext, NULL);
|
||||||
|
|
||||||
|
@ -6302,37 +6304,16 @@ void P_RunShadows(void)
|
||||||
continue; // shouldn't you already be dead?
|
continue; // shouldn't you already be dead?
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mobj->target->flags2 & MF2_DONTDRAW)
|
if (mobj->target->player)
|
||||||
|| (((mobj->target->eflags & MFE_VERTICALFLIP) && mobj->target->z+mobj->target->height > mobj->target->ceilingz)
|
floorz = mobj->target->floorz;
|
||||||
|| (!(mobj->target->eflags & MFE_VERTICALFLIP) && mobj->target->z < mobj->target->floorz)))
|
else // FOR SOME REASON, plain floorz is not reliable for normal objects, only players?!
|
||||||
|
floorz = P_FloorzAtPos(mobj->target->x, mobj->target->y, mobj->target->z, mobj->target->height);
|
||||||
|
|
||||||
|
K_MatchGenericExtraFlags(mobj, mobj->target);
|
||||||
|
|
||||||
|
if (((mobj->target->eflags & MFE_VERTICALFLIP) && mobj->target->z+mobj->target->height > mobj->target->ceilingz)
|
||||||
|
|| (!(mobj->target->eflags & MFE_VERTICALFLIP) && mobj->target->z < floorz))
|
||||||
mobj->flags2 |= MF2_DONTDRAW;
|
mobj->flags2 |= MF2_DONTDRAW;
|
||||||
else
|
|
||||||
mobj->flags2 &= ~MF2_DONTDRAW;
|
|
||||||
|
|
||||||
if (mobj->target->eflags & MFE_VERTICALFLIP)
|
|
||||||
mobj->eflags |= MFE_VERTICALFLIP;
|
|
||||||
else
|
|
||||||
mobj->eflags &= ~MFE_VERTICALFLIP;
|
|
||||||
|
|
||||||
if (mobj->target->eflags & MFE_DRAWONLYFORP1) // groooooaann...
|
|
||||||
mobj->eflags |= MFE_DRAWONLYFORP1;
|
|
||||||
else
|
|
||||||
mobj->eflags &= ~MFE_DRAWONLYFORP1;
|
|
||||||
|
|
||||||
if (mobj->target->eflags & MFE_DRAWONLYFORP2)
|
|
||||||
mobj->eflags |= MFE_DRAWONLYFORP2;
|
|
||||||
else
|
|
||||||
mobj->eflags &= ~MFE_DRAWONLYFORP2;
|
|
||||||
|
|
||||||
if (mobj->target->eflags & MFE_DRAWONLYFORP3)
|
|
||||||
mobj->eflags |= MFE_DRAWONLYFORP3;
|
|
||||||
else
|
|
||||||
mobj->eflags &= ~MFE_DRAWONLYFORP3;
|
|
||||||
|
|
||||||
if (mobj->target->eflags & MFE_DRAWONLYFORP4)
|
|
||||||
mobj->eflags |= MFE_DRAWONLYFORP4;
|
|
||||||
else
|
|
||||||
mobj->eflags &= ~MFE_DRAWONLYFORP4;
|
|
||||||
|
|
||||||
// First scale to the same radius
|
// First scale to the same radius
|
||||||
P_SetScale(mobj, FixedDiv(mobj->target->radius, mobj->info->radius));
|
P_SetScale(mobj, FixedDiv(mobj->target->radius, mobj->info->radius));
|
||||||
|
@ -6345,12 +6326,12 @@ void P_RunShadows(void)
|
||||||
P_TeleportMove(mobj, dest->x, dest->y, mobj->target->z);
|
P_TeleportMove(mobj, dest->x, dest->y, mobj->target->z);
|
||||||
|
|
||||||
if (((mobj->eflags & MFE_VERTICALFLIP) && (mobj->ceilingz > mobj->z+mobj->height))
|
if (((mobj->eflags & MFE_VERTICALFLIP) && (mobj->ceilingz > mobj->z+mobj->height))
|
||||||
|| (!(mobj->eflags & MFE_VERTICALFLIP) && (mobj->floorz < mobj->z)))
|
|| (!(mobj->eflags & MFE_VERTICALFLIP) && (floorz < mobj->z)))
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
fixed_t prevz;
|
fixed_t prevz;
|
||||||
|
|
||||||
mobj->z = (mobj->eflags & MFE_VERTICALFLIP ? mobj->ceilingz : mobj->floorz);
|
mobj->z = (mobj->eflags & MFE_VERTICALFLIP ? mobj->ceilingz : floorz);
|
||||||
|
|
||||||
for (i = 0; i < MAXFFLOORS; i++)
|
for (i = 0; i < MAXFFLOORS; i++)
|
||||||
{
|
{
|
||||||
|
@ -6362,7 +6343,7 @@ void P_RunShadows(void)
|
||||||
// Check new position to see if you should still be on that ledge
|
// Check new position to see if you should still be on that ledge
|
||||||
P_TeleportMove(mobj, dest->x, dest->y, mobj->z);
|
P_TeleportMove(mobj, dest->x, dest->y, mobj->z);
|
||||||
|
|
||||||
mobj->z = (mobj->eflags & MFE_VERTICALFLIP ? mobj->ceilingz : mobj->floorz);
|
mobj->z = (mobj->eflags & MFE_VERTICALFLIP ? mobj->ceilingz : floorz);
|
||||||
|
|
||||||
if (mobj->z == prevz)
|
if (mobj->z == prevz)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue