by Graf Zahl » Sat Jan 19, 2019 2:19 am
Interesting. The last time someone encountered this bug the following happened:
Code: Select all
DEFINE_ACTION_FUNCTION(FLevelLocals, SphericalCoords)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_FLOAT(viewpointX);
PARAM_FLOAT(viewpointY);
PARAM_FLOAT(viewpointZ);
PARAM_FLOAT(targetX);
PARAM_FLOAT(targetY);
PARAM_FLOAT(targetZ);
PARAM_ANGLE(viewYaw);
PARAM_ANGLE(viewPitch);
PARAM_BOOL(absolute);
DVector3 viewpoint(viewpointX, viewpointY, viewpointZ);
DVector3 target(targetX, targetY, targetZ);
auto vecTo = absolute ? target - viewpoint : VecDiff(self, viewpoint, target);
ACTION_RETURN_VEC3(DVector3(
deltaangle(vecTo.Angle(), viewYaw).Degrees,
deltaangle(-vecTo.Pitch(), viewPitch).Degrees,
vecTo.Length()
));
See that '-' in front of vecTo.Pitch()? That's only there to compensate for the bug. The TVector::Pitch() function got the pitch's sign inverted. Fortunately there's only 3 places in the entire engine using it, and one already compensates for the inversion.
The third place is the function to check actor visibility in the renderer and apparently isn't used in sufficient quantity to have registered. CMF_OFFSETPITCH is the only really critical one.
Let's just hope that no mod depends on it, otherwise a compatibility option will be needed.
Interesting. The last time someone encountered this bug the following happened:
[code]
DEFINE_ACTION_FUNCTION(FLevelLocals, SphericalCoords)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_FLOAT(viewpointX);
PARAM_FLOAT(viewpointY);
PARAM_FLOAT(viewpointZ);
PARAM_FLOAT(targetX);
PARAM_FLOAT(targetY);
PARAM_FLOAT(targetZ);
PARAM_ANGLE(viewYaw);
PARAM_ANGLE(viewPitch);
PARAM_BOOL(absolute);
DVector3 viewpoint(viewpointX, viewpointY, viewpointZ);
DVector3 target(targetX, targetY, targetZ);
auto vecTo = absolute ? target - viewpoint : VecDiff(self, viewpoint, target);
ACTION_RETURN_VEC3(DVector3(
deltaangle(vecTo.Angle(), viewYaw).Degrees,
deltaangle(-vecTo.Pitch(), viewPitch).Degrees,
vecTo.Length()
));
[/code]
See that '-' in front of vecTo.Pitch()? That's only there to compensate for the bug. The TVector::Pitch() function got the pitch's sign inverted. Fortunately there's only 3 places in the entire engine using it, and one already compensates for the inversion.
The third place is the function to check actor visibility in the renderer and apparently isn't used in sufficient quantity to have registered. CMF_OFFSETPITCH is the only really critical one.
Let's just hope that no mod depends on it, otherwise a compatibility option will be needed.