mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 05:01:41 +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)
|
||||
{
|
||||
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