mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-30 12:31:07 +00:00
- Don't use Normalized180() on angles. This could result in ranges being wrongly inverted.
- Fixed properties not having the proper indices. - Use ViewPos-to-actor instead of measuring actor-to-actor. - Use the actual camera instead of the actor so camera textures can work.
This commit is contained in:
parent
a419b581a8
commit
74b8e9f286
2 changed files with 14 additions and 15 deletions
|
@ -70,6 +70,7 @@
|
||||||
#include "p_spec.h"
|
#include "p_spec.h"
|
||||||
#include "p_checkposition.h"
|
#include "p_checkposition.h"
|
||||||
#include "serializer.h"
|
#include "serializer.h"
|
||||||
|
#include "r_utility.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -1040,11 +1041,11 @@ bool AActor::IsInsideVisibleAngles() const
|
||||||
if (players[consoleplayer].camera == nullptr)
|
if (players[consoleplayer].camera == nullptr)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
DAngle anglestart = VisibleStartAngle.Normalized180();
|
DAngle anglestart = VisibleStartAngle;
|
||||||
DAngle angleend = VisibleEndAngle.Normalized180();
|
DAngle angleend = VisibleEndAngle;
|
||||||
DAngle pitchstart = VisibleStartPitch.Normalized180();
|
DAngle pitchstart = VisibleStartPitch;
|
||||||
DAngle pitchend = VisibleEndPitch.Normalized180();
|
DAngle pitchend = VisibleEndPitch;
|
||||||
|
|
||||||
if (anglestart > angleend)
|
if (anglestart > angleend)
|
||||||
{
|
{
|
||||||
DAngle temp = anglestart;
|
DAngle temp = anglestart;
|
||||||
|
@ -1058,22 +1059,20 @@ bool AActor::IsInsideVisibleAngles() const
|
||||||
pitchstart = pitchend;
|
pitchstart = pitchend;
|
||||||
pitchend = temp;
|
pitchend = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
player_t* pPlayer = players[consoleplayer].camera->player;
|
AActor *mo = players[consoleplayer].camera;
|
||||||
|
|
||||||
if (pPlayer && pPlayer->mo)
|
if (mo != nullptr)
|
||||||
{
|
{
|
||||||
AActor *mo = pPlayer->mo;
|
|
||||||
DVector3 diffang = Vec3To(mo);
|
DVector3 diffang = ViewPos - Pos();
|
||||||
DAngle to = diffang.Angle();
|
DAngle to = diffang.Angle();
|
||||||
|
|
||||||
if (!(renderflags & RF_ABSMASKANGLE))
|
if (!(renderflags & RF_ABSMASKANGLE))
|
||||||
to = deltaangle(Angles.Yaw, to);
|
to = deltaangle(Angles.Yaw, to);
|
||||||
|
|
||||||
// Note that this check is inversed due to only being able to vectorize
|
if ((to >= anglestart && to <= angleend))
|
||||||
// from one way (this actor to the player). It still means to pass
|
|
||||||
// if the player is within the visible angles.
|
|
||||||
if ((to <= anglestart || to >= angleend))
|
|
||||||
{
|
{
|
||||||
to = diffang.Pitch();
|
to = diffang.Pitch();
|
||||||
if (!(renderflags & RF_ABSMASKPITCH))
|
if (!(renderflags & RF_ABSMASKPITCH))
|
||||||
|
|
|
@ -1437,7 +1437,7 @@ DEFINE_PROPERTY(spriterotation, F, Actor)
|
||||||
DEFINE_PROPERTY(visibleangles, Ff, Actor)
|
DEFINE_PROPERTY(visibleangles, Ff, Actor)
|
||||||
{
|
{
|
||||||
PROP_DOUBLE_PARM(visstart, 0);
|
PROP_DOUBLE_PARM(visstart, 0);
|
||||||
PROP_DOUBLE_PARM(visend, 0);
|
PROP_DOUBLE_PARM(visend, 1);
|
||||||
defaults->VisibleStartAngle = visstart;
|
defaults->VisibleStartAngle = visstart;
|
||||||
defaults->VisibleEndAngle = visend;
|
defaults->VisibleEndAngle = visend;
|
||||||
}
|
}
|
||||||
|
@ -1448,7 +1448,7 @@ DEFINE_PROPERTY(visibleangles, Ff, Actor)
|
||||||
DEFINE_PROPERTY(visiblepitch, Ff, Actor)
|
DEFINE_PROPERTY(visiblepitch, Ff, Actor)
|
||||||
{
|
{
|
||||||
PROP_DOUBLE_PARM(visstart, 0);
|
PROP_DOUBLE_PARM(visstart, 0);
|
||||||
PROP_DOUBLE_PARM(visend, 0);
|
PROP_DOUBLE_PARM(visend, 1);
|
||||||
defaults->VisibleStartPitch = visstart;
|
defaults->VisibleStartPitch = visstart;
|
||||||
defaults->VisibleEndPitch = visend;
|
defaults->VisibleEndPitch = visend;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue