diff --git a/src/m_fixed.c b/src/m_fixed.c index bfbe81f95..d45bb70bf 100644 --- a/src/m_fixed.c +++ b/src/m_fixed.c @@ -121,16 +121,6 @@ fixed_t FixedHypot(fixed_t x, fixed_t y) return FixedMul(ax, yx1); // |x|*((1 + (x/y)^2)^1/2) } -fixed_t FixedEuclidean(fixed_t x2, fixed_t y2, fixed_t x1, fixed_t y1) -{ - INT64 dx = x2-x1; - INT64 dy = y2-y1; - union {INT64 i; float x;} u; - u.x = (dx*dx+dy*dy); - u.i = (1<<29) + (u.i >> 1) - (1<<22); - return (fixed_t)llrintf(u.x); -} - vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y) { vec->x = x; diff --git a/src/m_fixed.h b/src/m_fixed.h index 281802fb6..4609913b7 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -237,17 +237,6 @@ FUNCMATH fixed_t FixedSqrt(fixed_t x); */ FUNCMATH fixed_t FixedHypot(fixed_t x, fixed_t y); -/** \brief The FixedEuclidean function - - \param x fixed_t number - \param y fixed_t number - - \return sqrt(x*x+y*y) - - -*/ -fixed_t FixedEuclidean(fixed_t x2, fixed_t y2, fixed_t x1, fixed_t y1); - /** \brief The FixedFloor function \param x fixed_t number diff --git a/src/p_setup.c b/src/p_setup.c index f018b6635..45bfb616c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -389,7 +389,9 @@ static inline void P_LoadVertexes(lumpnum_t lumpnum) */ fixed_t P_SegLength(seg_t *seg) { - return FixedEuclidean(seg->v2->x,seg->v2->y,seg->v1->x,seg->v1->y); + INT64 dx = (seg->v2->x - seg->v1->x)>>1; + INT64 dy = (seg->v2->y - seg->v1->y)>>1; + return FixedHypot(dx, dy)<<1; } #ifdef HWRENDER @@ -2626,7 +2628,7 @@ static boolean P_CanSave(void) { // Saving is completely ignored under these conditions: if ((cursaveslot < 0) // Playing without saving - || (!modifiedgame || savemoddata) // Game is modified + || (!modifiedgame || savemoddata) // Game is modified || (netgame || multiplayer) // Not in single-player || (demoplayback || demorecording || metalrecording) // Currently in demo || (players[consoleplayer].lives <= 0) // Completely dead @@ -2637,7 +2639,7 @@ static boolean P_CanSave(void) return true; // Saving should ALWAYS happen! else if (mapheaderinfo[gamemap-1]->saveoverride == SAVE_NEVER) return false; // Saving should NEVER happen! - + // Default condition: In a non-hidden map, at the beginning of a zone or on a completed save-file, and not on save reload. return (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU) && (mapheaderinfo[gamemap-1]->actnum < 2 || gamecomplete)