Mapster32: when 3D-inserting sprite higher than z extent, position at floor...

... when aiming at the floor.

git-svn-id: https://svn.eduke32.com/eduke32@3780 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-05-16 21:54:59 +00:00
parent 6e364b1f4b
commit b1f58387db
2 changed files with 12 additions and 5 deletions

View file

@ -452,14 +452,23 @@ static inline void dtol(double d, int32_t *a)
#endif
#if __GNUC__ >= 4
static inline __attribute__((warn_unused_result)) int32_t clamp(int32_t in, int32_t min, int32_t max)
# define CLAMP_DECL static inline __attribute__((warn_unused_result))
#else
static inline int32_t clamp(int32_t in, int32_t min, int32_t max)
# define CLAMP_DECL static inline
#endif
// Clamp <in> to [<min>..<max>]. The case in <= min is handled first.
CLAMP_DECL int32_t clamp(int32_t in, int32_t min, int32_t max)
{
return in <= min ? min : (in >= max ? max : in);
}
// Clamp <in> to [<min>..<max>]. The case in >= max is handled first.
CLAMP_DECL int32_t clamp2(int32_t in, int32_t min, int32_t max)
{
return in >= max ? max : (in <= min ? min : in);
}
#define BMAX_PATH 256

View file

@ -1257,10 +1257,8 @@ void editinput(void)
handle_sprite_in_clipboard(i);
getzsofslope(hit.sect, hit.pos.x, hit.pos.y, &cz, &fz);
spriteoncfz(i, &cz, &fz);
sprite[i].z = clamp(hit.pos.z, cz, fz);
sprite[i].z = clamp2(hit.pos.z, cz, fz);
if (AIMING_AT_WALL || AIMING_AT_MASKWALL)
{