diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 5e34de756..8021514a6 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -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); diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 28fcf4698..b73741866 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -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; diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 2413a0f6b..f502bbdc0 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -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;