mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Factor out approaching val. to target val by half-difference steps into logapproach().
Fix a case in G_MovePlayers(), where the player sprite's shade is approached toward the ceiling/floor's shade. Before, it could stop at one above or below! git-svn-id: https://svn.eduke32.com/eduke32@4392 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
2f11c7d802
commit
21de8bb53a
3 changed files with 9 additions and 7 deletions
|
@ -1178,6 +1178,12 @@ static inline uint32_t uhypsq(int32_t dx, int32_t dy)
|
|||
return (uint32_t)dx*dx + (uint32_t)dy*dy;
|
||||
}
|
||||
|
||||
static inline int32_t logapproach(int32_t val, int32_t targetval)
|
||||
{
|
||||
int32_t dif = targetval - val;
|
||||
return (dif>>1) ? val + (dif>>1) : targetval;
|
||||
}
|
||||
|
||||
void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y,
|
||||
int16_t daang, int32_t *x2, int32_t *y2) ATTRIBUTE((nonnull(6,7)));
|
||||
int32_t lastwall(int16_t point);
|
||||
|
|
|
@ -1309,9 +1309,9 @@ ACTOR_STATIC void G_MovePlayers(void)
|
|||
}
|
||||
|
||||
if (sector[s->sectnum].ceilingstat&1)
|
||||
s->shade += (sector[s->sectnum].ceilingshade-s->shade)>>1;
|
||||
s->shade = logapproach(s->shade, sector[s->sectnum].ceilingshade);
|
||||
else
|
||||
s->shade += (sector[s->sectnum].floorshade-s->shade)>>1;
|
||||
s->shade = logapproach(s->shade, sector[s->sectnum].floorshade);
|
||||
|
||||
BOLT:
|
||||
i = nexti;
|
||||
|
|
|
@ -1808,11 +1808,7 @@ static void G_DrawWeaponTile(int32_t x, int32_t y, int32_t tilenum, int32_t shad
|
|||
shadef[slot] += (shade-shadef[slot])>>2;
|
||||
|
||||
if (!((shade-shadef[slot])>>2))
|
||||
{
|
||||
shadef[slot] += (shade-shadef[slot])>>1;
|
||||
if (!((shade-shadef[slot])>>1))
|
||||
shadef[slot] = shade;
|
||||
}
|
||||
shadef[slot] = logapproach(shadef[slot], shade);
|
||||
}
|
||||
else
|
||||
shadef[slot] = shade;
|
||||
|
|
Loading…
Reference in a new issue