mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
- Added a flag to make bouncing objects disappear when hitting sky surfaces
This commit is contained in:
parent
00d97197db
commit
b79e3f8904
7 changed files with 28 additions and 8 deletions
|
@ -488,6 +488,7 @@ enum ActorBounceFlag
|
||||||
BOUNCE_UseBounceState = 1<<14, // Use Bounce[.*] states
|
BOUNCE_UseBounceState = 1<<14, // Use Bounce[.*] states
|
||||||
BOUNCE_NotOnShootables = 1<<15, // do not bounce off shootable actors if we are a projectile. Explode instead.
|
BOUNCE_NotOnShootables = 1<<15, // do not bounce off shootable actors if we are a projectile. Explode instead.
|
||||||
BOUNCE_BounceOnUnrips = 1<<16, // projectile bounces on actors with DONTRIP
|
BOUNCE_BounceOnUnrips = 1<<16, // projectile bounces on actors with DONTRIP
|
||||||
|
BOUNCE_NotOnSky = 1<<17, // Don't bounce on sky floors / ceilings / walls
|
||||||
|
|
||||||
BOUNCE_TypeMask = BOUNCE_Walls | BOUNCE_Floors | BOUNCE_Ceilings | BOUNCE_Actors | BOUNCE_AutoOff | BOUNCE_HereticType | BOUNCE_MBF,
|
BOUNCE_TypeMask = BOUNCE_Walls | BOUNCE_Floors | BOUNCE_Ceilings | BOUNCE_Actors | BOUNCE_AutoOff | BOUNCE_HereticType | BOUNCE_MBF,
|
||||||
|
|
||||||
|
@ -1376,7 +1377,7 @@ public:
|
||||||
DVector3 PosRelative(int grp) const;
|
DVector3 PosRelative(int grp) const;
|
||||||
DVector3 PosRelative(const AActor *other) const;
|
DVector3 PosRelative(const AActor *other) const;
|
||||||
DVector3 PosRelative(sector_t *sec) const;
|
DVector3 PosRelative(sector_t *sec) const;
|
||||||
DVector3 PosRelative(line_t *line) const;
|
DVector3 PosRelative(const line_t *line) const;
|
||||||
|
|
||||||
FVector3 SoundPos() const
|
FVector3 SoundPos() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ inline DVector3 AActor::PosRelative(sector_t *sec) const
|
||||||
return Pos() + level.Displacements.getOffset(Sector->PortalGroup, sec->PortalGroup);
|
return Pos() + level.Displacements.getOffset(Sector->PortalGroup, sec->PortalGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline DVector3 AActor::PosRelative(line_t *line) const
|
inline DVector3 AActor::PosRelative(const line_t *line) const
|
||||||
{
|
{
|
||||||
return Pos() + level.Displacements.getOffset(Sector->PortalGroup, line->frontsector->PortalGroup);
|
return Pos() + level.Displacements.getOffset(Sector->PortalGroup, line->frontsector->PortalGroup);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "doomdata.h"
|
#include "doomdata.h"
|
||||||
#include "g_level.h"
|
#include "g_level.h"
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
|
#include "r_sky.h"
|
||||||
#include "portal.h"
|
#include "portal.h"
|
||||||
#include "p_blockmap.h"
|
#include "p_blockmap.h"
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
|
@ -318,3 +319,10 @@ inline int line_t::getPortalAlignment() const
|
||||||
{
|
{
|
||||||
return portalindex >= level.linePortals.Size() ? 0 : level.linePortals[portalindex].mAlign;
|
return portalindex >= level.linePortals.Size() ? 0 : level.linePortals[portalindex].mAlign;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool line_t::hitSkyWall(AActor* mo) const
|
||||||
|
{
|
||||||
|
return backsector &&
|
||||||
|
backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
|
||||||
|
mo->Z() >= backsector->ceilingplane.ZatPoint(mo->PosRelative(this));
|
||||||
|
}
|
||||||
|
|
|
@ -3551,9 +3551,9 @@ bool FSlide::BounceWall(AActor *mo)
|
||||||
}
|
}
|
||||||
line = bestslideline;
|
line = bestslideline;
|
||||||
|
|
||||||
if (line->special == Line_Horizon)
|
if (line->special == Line_Horizon || (mo->BounceFlags & BOUNCE_NotOnSky) && line->hitSkyWall(mo))
|
||||||
{
|
{
|
||||||
mo->SeeSound = 0; // it might make a sound otherwise
|
mo->SeeSound = mo->BounceSound = 0; // it might make a sound otherwise
|
||||||
mo->Destroy();
|
mo->Destroy();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2178,15 +2178,27 @@ bool AActor::FloorBounceMissile (secplane_t &plane)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool onsky;
|
||||||
|
|
||||||
if (plane.fC() < 0)
|
if (plane.fC() < 0)
|
||||||
{ // on ceiling
|
{ // on ceiling
|
||||||
if (!(BounceFlags & BOUNCE_Ceilings))
|
if (!(BounceFlags & BOUNCE_Ceilings))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
onsky = ceilingpic == skyflatnum;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // on floor
|
{ // on floor
|
||||||
if (!(BounceFlags & BOUNCE_Floors))
|
if (!(BounceFlags & BOUNCE_Floors))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
onsky = floorpic == skyflatnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onsky && (BounceFlags & BOUNCE_NotOnSky))
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The amount of bounces is limited
|
// The amount of bounces is limited
|
||||||
|
@ -2751,10 +2763,7 @@ double P_XYMovement (AActor *mo, DVector2 scroll)
|
||||||
explode:
|
explode:
|
||||||
// explode a missile
|
// explode a missile
|
||||||
bool onsky = false;
|
bool onsky = false;
|
||||||
if (tm.ceilingline &&
|
if (tm.ceilingline && tm.ceilingline->hitSkyWall(mo))
|
||||||
tm.ceilingline->backsector &&
|
|
||||||
tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
|
|
||||||
mo->Z() >= tm.ceilingline->backsector->ceilingplane.ZatPoint(mo->PosRelative(tm.ceilingline)))
|
|
||||||
{
|
{
|
||||||
if (!(mo->flags3 & MF3_SKYEXPLODE))
|
if (!(mo->flags3 & MF3_SKYEXPLODE))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1393,6 +1393,7 @@ struct line_t
|
||||||
inline bool isVisualPortal() const;
|
inline bool isVisualPortal() const;
|
||||||
inline line_t *getPortalDestination() const;
|
inline line_t *getPortalDestination() const;
|
||||||
inline int getPortalAlignment() const;
|
inline int getPortalAlignment() const;
|
||||||
|
inline bool hitSkyWall(AActor* mo) const;
|
||||||
|
|
||||||
int Index() const;
|
int Index() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -360,6 +360,7 @@ static FFlagDef ActorFlagDefs[]=
|
||||||
DEFINE_FLAG2(BOUNCE_UseBounceState, USEBOUNCESTATE, AActor, BounceFlags),
|
DEFINE_FLAG2(BOUNCE_UseBounceState, USEBOUNCESTATE, AActor, BounceFlags),
|
||||||
DEFINE_FLAG2(BOUNCE_NotOnShootables, DONTBOUNCEONSHOOTABLES, AActor, BounceFlags),
|
DEFINE_FLAG2(BOUNCE_NotOnShootables, DONTBOUNCEONSHOOTABLES, AActor, BounceFlags),
|
||||||
DEFINE_FLAG2(BOUNCE_BounceOnUnrips, BOUNCEONUNRIPPABLES, AActor, BounceFlags),
|
DEFINE_FLAG2(BOUNCE_BounceOnUnrips, BOUNCEONUNRIPPABLES, AActor, BounceFlags),
|
||||||
|
DEFINE_FLAG2(BOUNCE_NotOnSky, DONTBOUNCEONSKY, AActor, BounceFlags),
|
||||||
};
|
};
|
||||||
|
|
||||||
// These won't be accessible through bitfield variables
|
// These won't be accessible through bitfield variables
|
||||||
|
|
Loading…
Reference in a new issue