Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Jan 7, 2025
1 parent 0f0d551 commit 6e6bd89
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/am_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ static void AM_DrawThings(void)
}
else
{
angle = R_InterpolateAngle(thing->oldangle, thing->angle, fractionaltic);
angle = R_InterpolateAngle(thing->oldangle, thing->angle);
point.x = (thing->oldx + FixedMul(thing->x - thing->oldx, fractionaltic)) >> FRACTOMAPBITS;
point.y = (thing->oldy + FixedMul(thing->y - thing->oldy, fractionaltic)) >> FRACTOMAPBITS;
}
Expand Down
4 changes: 3 additions & 1 deletion src/p_mobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@ static void P_ZMovement(mobj_t *mo)

if (flags & MF_MISSILE)
{
if (ceilingline && ceilingline->backsector && ceilingline->backsector->ceilingpic == skyflatnum
if (ceilingline
&& ceilingline->backsector
&& ceilingline->backsector->ceilingpic == skyflatnum
&& mo->z > ceilingline->backsector->ceilingheight)
P_RemoveMobj(mo); // don't explode on skies
else
Expand Down
12 changes: 6 additions & 6 deletions src/r_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,24 +245,24 @@ angle_t R_PointToAngleEx2(fixed_t x1, fixed_t y1, fixed_t x, fixed_t y)
}

// [AM] Interpolate between two angles.
angle_t R_InterpolateAngle(angle_t oangle, angle_t nangle, fixed_t scale)
angle_t R_InterpolateAngle(angle_t oangle, angle_t nangle)
{
if (nangle == oangle)
return nangle;

if (nangle > oangle)
{
if (nangle - oangle < ANG270)
return (oangle + (angle_t)((nangle - oangle) * FIXED2DOUBLE(scale)));
return (oangle + (angle_t)((nangle - oangle) * FIXED2DOUBLE(fractionaltic)));
else
return (oangle - (angle_t)((oangle - nangle) * FIXED2DOUBLE(scale))); // Wrapped around
return (oangle - (angle_t)((oangle - nangle) * FIXED2DOUBLE(fractionaltic)));
}
else
{
if (oangle - nangle < ANG270)
return (oangle - (angle_t)((oangle - nangle) * FIXED2DOUBLE(scale)));
return (oangle - (angle_t)((oangle - nangle) * FIXED2DOUBLE(fractionaltic)));
else
return (oangle + (angle_t)((nangle - oangle) * FIXED2DOUBLE(scale))); // Wrapped around
return (oangle + (angle_t)((nangle - oangle) * FIXED2DOUBLE(fractionaltic)));
}
}

Expand Down Expand Up @@ -1039,7 +1039,7 @@ static void R_SetupFrame(void)
viewx = mo->oldx + FixedMul(mo->x - mo->oldx, fractionaltic);
viewy = mo->oldy + FixedMul(mo->y - mo->oldy, fractionaltic);
viewz = viewplayer->oldviewz + FixedMul(viewplayer->viewz - viewplayer->oldviewz, fractionaltic);
viewangle = R_InterpolateAngle(mo->oldangle, mo->angle, fractionaltic);
viewangle = R_InterpolateAngle(mo->oldangle, mo->angle);

if (canfreelook)
pitch = (viewplayer->oldlookdir + (int)((viewplayer->lookdir - viewplayer->oldlookdir)
Expand Down
2 changes: 1 addition & 1 deletion src/r_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ angle_t R_PointToAngle(fixed_t x, fixed_t y);
angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x, fixed_t y);
angle_t R_PointToAngleEx(fixed_t x, fixed_t y);
angle_t R_PointToAngleEx2(fixed_t x1, fixed_t y1, fixed_t x, fixed_t y);
angle_t R_InterpolateAngle(angle_t oangle, angle_t nangle, fixed_t scale);
angle_t R_InterpolateAngle(angle_t oangle, angle_t nangle);
subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);

//
Expand Down

0 comments on commit 6e6bd89

Please sign in to comment.