This commit is contained in:
Christoph Oelckers 2016-09-24 17:54:53 +02:00
commit 7d978a115e
4 changed files with 31 additions and 17 deletions

View file

@ -46,6 +46,11 @@ inline short LittleShort(int x)
return OSSwapLittleToHostInt16((uint16_t)x);
}
inline unsigned short LittleShort(unsigned int x)
{
return OSSwapLittleToHostInt16((uint16_t)x);
}
inline int LittleLong(int x)
{
return OSSwapLittleToHostInt32((uint32_t)x);
@ -56,6 +61,16 @@ inline unsigned int LittleLong(unsigned int x)
return OSSwapLittleToHostInt32(x);
}
inline int LittleLong(long x)
{
return OSSwapLittleToHostInt32((uint32_t)x);
}
inline unsigned int LittleLong(unsigned long x)
{
return OSSwapLittleToHostInt32((uint32_t)x);
}
inline short BigShort(short x)
{
return (short)OSSwapBigToHostInt16((uint16_t)x);

View file

@ -70,6 +70,7 @@
#include "p_spec.h"
#include "p_checkposition.h"
#include "serializer.h"
#include "r_utility.h"
// MACROS ------------------------------------------------------------------
@ -1040,11 +1041,11 @@ bool AActor::IsInsideVisibleAngles() const
if (players[consoleplayer].camera == nullptr)
return true;
DAngle anglestart = VisibleStartAngle.Normalized180();
DAngle angleend = VisibleEndAngle.Normalized180();
DAngle pitchstart = VisibleStartPitch.Normalized180();
DAngle pitchend = VisibleEndPitch.Normalized180();
DAngle anglestart = VisibleStartAngle;
DAngle angleend = VisibleEndAngle;
DAngle pitchstart = VisibleStartPitch;
DAngle pitchend = VisibleEndPitch;
if (anglestart > angleend)
{
DAngle temp = anglestart;
@ -1052,28 +1053,26 @@ bool AActor::IsInsideVisibleAngles() const
angleend = temp;
}
if (pitchstart > angleend)
if (pitchstart > pitchend)
{
DAngle temp = pitchstart;
pitchstart = pitchend;
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();
if (!(renderflags & RF_ABSMASKANGLE))
to = deltaangle(Angles.Yaw, to);
// Note that this check is inversed due to only being able to vectorize
// 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))
if ((to >= anglestart && to <= angleend))
{
to = diffang.Pitch();
if (!(renderflags & RF_ABSMASKPITCH))

View file

@ -1294,7 +1294,7 @@ FSerializer &SerializePointer(FSerializer &arc, const char *key, T *&value, T **
assert(base != nullptr);
if (arc.isReading() || !arc.w->inObject() || defval == nullptr || value != *defval)
{
ptrdiff_t vv = value == nullptr ? -1 : value - base;
int64_t vv = value == nullptr ? -1 : value - base;
Serialize(arc, key, vv, nullptr);
value = vv < 0 ? nullptr : base + vv;
}

View file

@ -1437,7 +1437,7 @@ DEFINE_PROPERTY(spriterotation, F, Actor)
DEFINE_PROPERTY(visibleangles, Ff, Actor)
{
PROP_DOUBLE_PARM(visstart, 0);
PROP_DOUBLE_PARM(visend, 0);
PROP_DOUBLE_PARM(visend, 1);
defaults->VisibleStartAngle = visstart;
defaults->VisibleEndAngle = visend;
}
@ -1448,7 +1448,7 @@ DEFINE_PROPERTY(visibleangles, Ff, Actor)
DEFINE_PROPERTY(visiblepitch, Ff, Actor)
{
PROP_DOUBLE_PARM(visstart, 0);
PROP_DOUBLE_PARM(visend, 0);
PROP_DOUBLE_PARM(visend, 1);
defaults->VisibleStartPitch = visstart;
defaults->VisibleEndPitch = visend;
}