mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- added NULL pointer check to portal rotation calculation function.
This commit is contained in:
parent
0a92138edf
commit
8c027aef8b
1 changed files with 9 additions and 6 deletions
|
@ -245,12 +245,15 @@ static line_t *FindDestination(line_t *src, int tag)
|
|||
|
||||
static void SetRotation(FLinePortal *port)
|
||||
{
|
||||
line_t *dst = port->mDestination;
|
||||
line_t *line = port->mOrigin;
|
||||
double angle = atan2(dst->dy, dst->dx) - atan2(line->dy, line->dx) + M_PI;
|
||||
port->mSinRot = FLOAT2FIXED(sin(angle));
|
||||
port->mCosRot = FLOAT2FIXED(cos(angle));
|
||||
port->mAngleDiff = RAD2ANGLE(angle);
|
||||
if (port != NULL && port->mDestination != NULL)
|
||||
{
|
||||
line_t *dst = port->mDestination;
|
||||
line_t *line = port->mOrigin;
|
||||
double angle = atan2(dst->dy, dst->dx) - atan2(line->dy, line->dx) + M_PI;
|
||||
port->mSinRot = FLOAT2FIXED(sin(angle));
|
||||
port->mCosRot = FLOAT2FIXED(cos(angle));
|
||||
port->mAngleDiff = RAD2ANGLE(angle);
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
Loading…
Reference in a new issue