[prboom+] 02/03: Imported Upstream version 2.5.1.4~svn4441+dfsg1

Fabian Greffrath fabian at moszumanska.debian.org
Fri Sep 25 18:33:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

fabian pushed a commit to branch master
in repository prboom+.

commit 5bcca63946f92dd2961ce541a849de5d713d8643
Author: Fabian Greffrath <fabian+debian at greffrath.com>
Date:   Fri Sep 25 20:33:14 2015 +0200

    Imported Upstream version 2.5.1.4~svn4441+dfsg1
---
 VisualC6/Doom.dsp    |   8 --
 VisualC8/Doom.vcproj |   8 --
 src/MAC/Rakefile     |   1 -
 src/Makefile.am      |   2 +-
 src/SDL/i_video.c    |   6 -
 src/doomstat.h       |   1 +
 src/e6y.c            |  36 +-----
 src/e6y.h            |   1 -
 src/gl_detail.c      |  12 +-
 src/gl_main.c        |  19 ++-
 src/gl_struct.h      |   1 -
 src/gl_vertex.c      |   4 +-
 src/i_smp.c          | 318 ---------------------------------------------------
 src/i_smp.h          |  66 -----------
 src/m_fixed.h        |   5 +
 src/m_menu.c         |  10 +-
 src/m_misc.c         |   8 +-
 src/p_floor.c        |   3 +-
 src/p_mobj.c         |   3 +
 src/p_pspr.c         |   4 +
 src/p_setup.c        |   8 +-
 src/r_bsp.c          |   8 +-
 src/r_defs.h         |   2 -
 src/r_draw.h         |   1 -
 src/r_fps.c          |  13 +--
 src/r_main.c         | 116 +++++--------------
 src/r_main.h         |  12 +-
 src/r_plane.c        |   7 +-
 src/r_segs.c         |  23 ++--
 src/r_things.c       |   2 +-
 src/tables.c         |  12 +-
 src/tables.h         |   4 +-
 src/v_video.c        |   7 +-
 33 files changed, 111 insertions(+), 620 deletions(-)

diff --git a/VisualC6/Doom.dsp b/VisualC6/Doom.dsp
index f27f580..ba33963 100644
--- a/VisualC6/Doom.dsp
+++ b/VisualC6/Doom.dsp
@@ -540,14 +540,6 @@ SOURCE=..\src\i_pcsound.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\src\i_smp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\i_smp.h
-# End Source File
-# Begin Source File
-
 SOURCE=..\src\SDL\i_sound.c
 # End Source File
 # Begin Source File
diff --git a/VisualC8/Doom.vcproj b/VisualC8/Doom.vcproj
index 33e6343..c65cf7f 100644
--- a/VisualC8/Doom.vcproj
+++ b/VisualC8/Doom.vcproj
@@ -2198,14 +2198,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\src\i_smp.c"
-				>
-			</File>
-			<File
-				RelativePath="..\src\i_smp.h"
-				>
-			</File>
-			<File
 				RelativePath="..\src\SDL\i_sound.c"
 				>
 				<FileConfiguration
diff --git a/src/MAC/Rakefile b/src/MAC/Rakefile
index 970c91f..2dbcb0f 100644
--- a/src/MAC/Rakefile
+++ b/src/MAC/Rakefile
@@ -117,7 +117,6 @@ hu_stuff.c
 hu_tracers.c
 i_capture.c
 i_pcsound.c
-i_smp.c
 icon.c
 info.c
 lprintf.c
diff --git a/src/Makefile.am b/src/Makefile.am
index e76e35b..c20da98 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -59,7 +59,7 @@ COMMON_SRC = \
  i_pcsound.c    i_pcsound.h        r_screenmultiply.c r_screenmultiply.h \
  g_overflow.c   g_overflow.h       hu_tracers.c     hu_tracers.h \
  s_advsound.c   s_advsound.h       i_capture.c      i_capture.h \
- sc_man.c       sc_man.h           i_smp.c          i_smp.h
+ sc_man.c       sc_man.h
 
 NET_CLIENT_SRC = d_client.c
 
diff --git a/src/SDL/i_video.c b/src/SDL/i_video.c
index 9641b1f..321c5ce 100644
--- a/src/SDL/i_video.c
+++ b/src/SDL/i_video.c
@@ -68,7 +68,6 @@
 #include "d_deh.h"
 #include "i_joy.h"
 #include "i_video.h"
-#include "i_smp.h"
 #include "i_capture.h"
 #include "z_zone.h"
 #include "s_sound.h"
@@ -1231,8 +1230,6 @@ void I_UpdateVideoMode(void)
       vid_8ingl.surface = NULL;
     }
 #endif
-
-    SMP_Free();
   }
 
   // e6y: initialisation of screen_multiply
@@ -1348,8 +1345,6 @@ void I_UpdateVideoMode(void)
     I_Error("Couldn't set %dx%d video mode [%s]", REAL_SCREENWIDTH, REAL_SCREENHEIGHT, SDL_GetError());
   }
 
-  SMP_Init();
-
 #if SDL_VERSION_ATLEAST(1, 3, 0)
 #ifdef GL_DOOM
   if (V_GetMode() == VID_MODEGL)
@@ -1439,7 +1434,6 @@ void I_UpdateVideoMode(void)
   if (V_GetMode() == VID_MODEGL)
   {
     M_ChangeFOV();
-    M_ChangeRenderPrecise();
     deh_changeCompTranslucency();
   }
 #endif
diff --git a/src/doomstat.h b/src/doomstat.h
index 29043d7..cbe6b47 100644
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -127,6 +127,7 @@ enum {
   comperr_hangsolid,
   comperr_blockmap,
   comperr_allowjump,
+  comperr_freeaim,
 
   COMPERR_NUM
 };
diff --git a/src/e6y.c b/src/e6y.c
index f25acae..d0bb699 100644
--- a/src/e6y.c
+++ b/src/e6y.c
@@ -300,7 +300,6 @@ static dboolean saved_fastdemo;
 static dboolean saved_nodrawers;
 static dboolean saved_nosfxparm;
 static dboolean saved_nomusicparm;
-static int saved_render_precise;
 
 void G_SkipDemoStart(void)
 {
@@ -308,7 +307,6 @@ void G_SkipDemoStart(void)
   saved_nodrawers = nodrawers;
   saved_nosfxparm = nosfxparm;
   saved_nomusicparm = nomusicparm;
-  saved_render_precise = render_precise;
 
   paused = false;
   
@@ -320,9 +318,6 @@ void G_SkipDemoStart(void)
   nosfxparm = true;
   nomusicparm = true;
 
-  render_precise = false;
-  M_ChangeRenderPrecise();
-
   I_Init2();
 }
 
@@ -335,9 +330,6 @@ void G_SkipDemoStop(void)
   nosfxparm = saved_nosfxparm;
   nomusicparm = saved_nomusicparm;
   
-  render_precise = saved_render_precise;
-  M_ChangeRenderPrecise();
-
   demo_stoponnext = false;
   demo_stoponend = false;
   demo_warp = false;
@@ -490,8 +482,8 @@ void M_ChangeMaxViewPitch(void)
   }
   else
   {
-    max_up = MIN(movement_maxviewpitch, 61);
-    max_dn = MIN(movement_maxviewpitch, 36);
+    max_up = MIN(movement_maxviewpitch, 56);
+    max_dn = MIN(movement_maxviewpitch, 32);
   }
 
   angle_up = (int)((float)max_up / 45.0f * ANG45);
@@ -503,30 +495,6 @@ void M_ChangeMaxViewPitch(void)
   viewpitch = 0;
 }
 
-void M_ChangeRenderPrecise(void)
-{
-#ifdef GL_DOOM
-  if (V_GetMode() != VID_MODEGL)
-  {
-    gl_seamless = false;
-    return;
-  }
-  else
-  {
-    if (render_precise)
-    {
-      gl_seamless = true;
-      gld_InitVertexData();
-    }
-    else
-    {
-      gl_seamless = false;
-      gld_CleanVertexData();
-    }
-  }
-#endif // GL_DOOM
-}
-
 void M_ChangeScreenMultipleFactor(void)
 {
   V_ChangeScreenResolution();
diff --git a/src/e6y.h b/src/e6y.h
index 02b7a57..0ddc584 100644
--- a/src/e6y.h
+++ b/src/e6y.h
@@ -200,7 +200,6 @@ void M_ChangeTextureUseHires(void);
 void M_ChangeAllowFog(void);
 void M_ChangeTextureHQResize(void);
 #endif
-void M_ChangeRenderPrecise(void);
 void M_ChangeSpeed(void);
 void M_ChangeScreenMultipleFactor(void);
 void M_ChangeInterlacedScanning(void);
diff --git a/src/gl_detail.c b/src/gl_detail.c
index 746a3b7..6c41b2c 100644
--- a/src/gl_detail.c
+++ b/src/gl_detail.c
@@ -177,7 +177,7 @@ void gld_DrawTriangleStripARB(GLWall *wall, gl_strip_coords_t *c1, gl_strip_coor
   glVertex3fv((const GLfloat*)&c1->v[0]);
 
   // split left edge of wall
-  //if (gl_seamless && !wall->glseg->fracleft)
+  //if (!wall->glseg->fracleft)
   //  gld_SplitLeftEdge(wall, true);
 
   // upper left corner
@@ -191,7 +191,7 @@ void gld_DrawTriangleStripARB(GLWall *wall, gl_strip_coords_t *c1, gl_strip_coor
   glVertex3fv((const GLfloat*)&c1->v[2]);
 
   // split right edge of wall
-  //if (gl_seamless && !wall->glseg->fracright)
+  //if (!wall->glseg->fracright)
   //  gld_SplitRightEdge(wall, true);
 
   // lower right corner
@@ -279,7 +279,7 @@ void gld_DrawWallWithDetail(GLWall *wall)
     glVertex3f(wall->glseg->x1,wall->ybottom,wall->glseg->z1);
 
     // split left edge of wall
-    if (gl_seamless && !wall->glseg->fracleft)
+    if (!wall->glseg->fracleft)
       gld_SplitLeftEdge(wall, true);
 
     // upper left corner
@@ -293,7 +293,7 @@ void gld_DrawWallWithDetail(GLWall *wall)
     glVertex3f(wall->glseg->x2,wall->ytop,wall->glseg->z2);
 
     // split right edge of wall
-    if (gl_seamless && !wall->glseg->fracright)
+    if (!wall->glseg->fracright)
       gld_SplitRightEdge(wall, true);
 
     // lower right corner
@@ -365,7 +365,7 @@ void gld_DrawWallDetail_NoARB(GLWall *wall)
       glVertex3f(wall->glseg->x1,wall->ybottom,wall->glseg->z1);
 
       // split left edge of wall
-      if (gl_seamless && !wall->glseg->fracleft)
+      if (!wall->glseg->fracleft)
         gld_SplitLeftEdge(wall, true);
 
       // upper left corner
@@ -377,7 +377,7 @@ void gld_DrawWallDetail_NoARB(GLWall *wall)
       glVertex3f(wall->glseg->x2,wall->ytop,wall->glseg->z2);
 
       // split right edge of wall
-      if (gl_seamless && !wall->glseg->fracright)
+      if (!wall->glseg->fracright)
         gld_SplitRightEdge(wall, true);
 
       // lower right corner
diff --git a/src/gl_main.c b/src/gl_main.c
index f47c28d..d446865 100644
--- a/src/gl_main.c
+++ b/src/gl_main.c
@@ -1521,7 +1521,7 @@ static void gld_DrawWall(GLWall *wall)
       glVertex3f(wall->glseg->x1,wall->ybottom,wall->glseg->z1);
 
       // split left edge of wall
-      if (gl_seamless && !wall->glseg->fracleft)
+      if (!wall->glseg->fracleft)
         gld_SplitLeftEdge(wall, false);
 
       // upper left corner
@@ -1533,7 +1533,7 @@ static void gld_DrawWall(GLWall *wall)
       glVertex3f(wall->glseg->x2,wall->ytop,wall->glseg->z2);
 
       // split right edge of wall
-      if (gl_seamless && !wall->glseg->fracright)
+      if (!wall->glseg->fracright)
         gld_SplitRightEdge(wall, false);
 
       // lower right corner
@@ -2493,7 +2493,7 @@ void gld_ProjectSprite(mobj_t* thing)
   {
     // choose a different rotation based on player view
     angle_t rot;
-    angle_t ang = R_PointToAngle(fx, fy);
+    angle_t ang = R_PointToAngle2(viewx, viewy, fx, fy);
     if (sprframe->lump[0] == sprframe->lump[1])
     {
       rot = (ang - thing->angle + (angle_t)(ANG45/2)*9) >> 28;
@@ -2670,16 +2670,13 @@ void gld_ProcessWall(GLWall *wall)
   // otherwise there are rendering artifacts worse than anything that could be seen 
   // on Geforce 2's! Made this a menu option because the speed impact is quite severe
   // and this special handling is not necessary on modern NVidia cards.
-  if (gl_seamless)
-  {
-    seg_t *seg = wall->seg;
+  seg_t *seg = wall->seg;
 
-    wall->glseg->fracleft  = 0;
-    wall->glseg->fracright = 0;
+  wall->glseg->fracleft  = 0;
+  wall->glseg->fracright = 0;
 
-    gld_RecalcVertexHeights(seg->linedef->v1);
-    gld_RecalcVertexHeights(seg->linedef->v2);
-  }
+  gld_RecalcVertexHeights(seg->linedef->v1);
+  gld_RecalcVertexHeights(seg->linedef->v2);
 
   gld_DrawWall(wall);
 }
diff --git a/src/gl_struct.h b/src/gl_struct.h
index bfd5017..a7cbc07 100644
--- a/src/gl_struct.h
+++ b/src/gl_struct.h
@@ -88,7 +88,6 @@ void M_ChangeLightMode(void);
 extern int gl_detail_maxdist;
 extern int gl_allow_detail_textures;
 
-extern int gl_seamless;
 void gld_InitVertexData();
 void gld_CleanVertexData();
 void gld_UpdateSplitData(sector_t *sector);
diff --git a/src/gl_vertex.c b/src/gl_vertex.c
index 40bfb30..47437a0 100644
--- a/src/gl_vertex.c
+++ b/src/gl_vertex.c
@@ -91,8 +91,6 @@ typedef struct vertexsplit_info_s
   byte validcount;
 } vertexsplit_info_t;
 
-int gl_seamless = false;
-
 static vertexsplit_info_t * gl_vertexsplit = NULL;
 
 typedef struct splitsbysector_s
@@ -335,7 +333,7 @@ void gld_InitVertexData()
   int ** vt_sectorlists;
   unsigned int * vt_sectorlists_size;
 
-  if (!gl_seamless || gl_vertexsplit)
+  if (gl_vertexsplit)
     return;
 
   vt_sectorlists = calloc(sizeof(vt_sectorlists[0]), numvertexes);
diff --git a/src/i_smp.c b/src/i_smp.c
deleted file mode 100644
index b26e608..0000000
--- a/src/i_smp.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/* Emacs style mode select   -*- C++ -*-
- *-----------------------------------------------------------------------------
- *
- *
- *  PrBoom: a Doom port merged with LxDoom and LSDLDoom
- *  based on BOOM, a modified and improved DOOM engine
- *  Copyright (C) 1999 by
- *  id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
- *  Copyright (C) 1999-2002 by
- *  Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
- *  Copyright 2005, 2006 by
- *  Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- *  02111-1307, USA.
- *
- * DESCRIPTION:
- *
- *-----------------------------------------------------------------------------*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "SDL.h"
-
-#include "i_video.h"
-#include "i_sound.h"
-#include "v_video.h"
-#include "r_draw.h"
-#include "lprintf.h"
-
-#include "i_smp.h"
-
-static SDL_Thread *smp_thread;
-static SDL_mutex *smp_mutex;
-static SDL_cond *renderCompletedEvent;
-static SDL_cond *renderCommandsEvent;
-static volatile int smp_ready;
-static volatile int smp_state;
-
-typedef enum
-{
-  SMP_DATA_SEGS,
-  SMP_DATA_SPANS,
-
-  SMP_DATA_MAX
-} smp_datatype_e;
-
-static smp_item_t smp_data[SMP_DATA_MAX];
-
-int use_smp_default;
-int use_smp;
-
-static void SMP_ResetBuffers(void)
-{
-  int i;
-
-  for (i = 0; i < SMP_DATA_MAX; i++)
-  {
-    smp_data[i].count = 0;
-    smp_data[i].index = 0;
-  }
-}
-
-static void SMP_SetState(int state)
-{
-  //SDL_LockMutex(segs_mutex);
-  smp_state = state;
-  //SDL_UnlockMutex(segs_mutex);
-}
-
-static int SMP_GetState(void)
-{
-  return smp_state;
-}
-
-static inline void SMP_CheckSize(smp_item_t *item, int size)
-{
-  if (item->count >= item->size)
-  {
-    while (item->index < item->count)
-    {
-      SDL_Delay(1);
-    }
-
-    item->size = (item->size == 0 ? 1024 : item->size * 2);
-    item->data.item = realloc(item->data.item, item->size * size);
-  }
-}
-
-void SMP_ColFunc(draw_column_vars_t *data)
-{
-  if (!use_smp)
-  {
-    data->colfunc(data);
-  }
-  else
-  {
-    smp_item_t *item = &smp_data[SMP_DATA_SEGS];
-
-    SMP_CheckSize(item, sizeof(item->data.segs[0]));
-    item->data.segs[item->count] = *data;
-    item->count++;
-  }
-}
-
-void SMP_SpanFunc(draw_span_vars_t *data)
-{
-  if (!use_smp)
-  {
-    R_DrawSpan(data);
-  }
-  else
-  {
-    smp_item_t *item = &smp_data[SMP_DATA_SPANS];
-
-    SMP_CheckSize(item, sizeof(item->data.spans[0]));
-    item->data.spans[item->count] = *data;
-    item->count++;
-  }
-}
-
-void SMP_RendererSleep(void)
-{
-  SDL_LockMutex(smp_mutex);
-  {
-    smp_ready = false;
-
-    // after this, the front end can exit SMP_FrontEndSleep
-    SDL_CondSignal(renderCompletedEvent);
-
-    while (!smp_ready)
-    {
-      SDL_CondWait(renderCommandsEvent, smp_mutex);
-    }
-  }
-  SDL_UnlockMutex(smp_mutex);
-}
-
-void SMP_FrontEndSleep(void)
-{
-  if (!use_smp)
-    return;
-
-  SMP_SetState(1);
-
-  SDL_LockMutex(smp_mutex);
-  {
-    while (smp_ready)
-    {
-      SDL_CondWait(renderCompletedEvent, smp_mutex);
-    }
-  }
-  SDL_UnlockMutex(smp_mutex);
-}
-
-void SMP_WakeRenderer(void)
-{
-  if (!use_smp)
-    return;
-
-  SMP_ResetBuffers();
-
-  SDL_LockMutex(smp_mutex);
-  {
-    smp_ready = true;
-
-    // after this, the renderer can continue through SMP_RendererSleep
-    SDL_CondSignal(renderCommandsEvent);
-  }
-  SDL_UnlockMutex(smp_mutex);
-}
-
-static inline void smp_draw(void)
-{
-  smp_item_t *segs = &smp_data[SMP_DATA_SEGS];
-  smp_item_t *spans = &smp_data[SMP_DATA_SPANS];
-
-  while (segs->index < segs->count)
-  {
-    segs->data.segs[segs->index].colfunc(&segs->data.segs[segs->index]);
-    segs->index++;
-  }
-
-  while (spans->index < spans->count)
-  {
-    R_DrawSpan(&spans->data.spans[spans->index]);
-    spans->index++;
-  }
-}
-
-int render_thread_func(void *unused)
-{
-  while (1)
-  {
-    // sleep until we have work to do
-    SMP_RendererSleep();
-
-    do
-    {
-      smp_draw();
-    }
-    while (SMP_GetState() != 1);
-
-    smp_draw();
-
-    SMP_SetState(0);
-  }
-
-  return 0;
-}
-
-void SMP_Init(void)
-{
-  static int first = 0;
-
-  use_smp = 0;
-
-  if (use_smp_default)
-  {
-    if (process_affinity_mask)
-    {
-      lprintf(LO_WARN,
-        "SMP_Init: Unable to init SMP if 'process_affinity_mask' is not a zero\n");
-      return;
-    }
-
-    if (!strcasecmp(snd_midiplayer, midiplayers[midi_player_sdl]))
-    {
-      lprintf(LO_WARN,
-        "SMP_Init: Unable to init SMP if 'Preffered MIDI Player' is '%s'\n",
-        midiplayers[midi_player_sdl]);
-      return;
-    }
-  }
-
-  if (V_GetMode() != VID_MODEGL)
-  {
-    if (use_smp_default && !smp_thread)
-    {
-      int i;
-
-      for (i = 0; i < SMP_DATA_MAX; i++)
-      {
-        memset(&smp_data[i], 0, sizeof(smp_data[i]));
-      }
-
-      smp_mutex = SDL_CreateMutex();
-      if (smp_mutex)
-      {
-        renderCommandsEvent = SDL_CreateCond();
-        renderCompletedEvent = SDL_CreateCond();
-        if (renderCommandsEvent && renderCompletedEvent)
-        {
-          smp_thread = SDL_CreateThread(render_thread_func, NULL);
-          if (smp_thread)
-          {
-            use_smp = true;
-          }
-        }
-      }
-
-      if (use_smp)
-      {
-        if (!first)
-        {
-          first = 1;
-          atexit(SMP_Free);
-        }
-      }
-      else
-      {
-        lprintf(LO_WARN, "SMP_Init: Unable to init SMP: %s\n", SDL_GetError());
-        SMP_Free();
-      }
-    }
-  }
-}
-
-void SMP_Free(void)
-{
-  if (smp_thread)
-  {
-    SDL_KillThread(smp_thread);
-    smp_thread = NULL;
-  }
-
-  if (renderCompletedEvent)
-  {
-    SDL_DestroyCond(renderCompletedEvent);
-    renderCompletedEvent = NULL;
-  }
-
-  if (renderCommandsEvent)
-  {
-    SDL_DestroyCond(renderCommandsEvent);
-    renderCommandsEvent = NULL;
-  }
-
-  if (smp_mutex)
-  {
-    SDL_DestroyMutex(smp_mutex);
-    smp_mutex = NULL;
-  }
-}
diff --git a/src/i_smp.h b/src/i_smp.h
deleted file mode 100644
index c0a5abd..0000000
--- a/src/i_smp.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Emacs style mode select   -*- C++ -*-
- *-----------------------------------------------------------------------------
- *
- *
- *  PrBoom: a Doom port merged with LxDoom and LSDLDoom
- *  based on BOOM, a modified and improved DOOM engine
- *  Copyright (C) 1999 by
- *  id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
- *  Copyright (C) 1999-2000 by
- *  Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
- *  Copyright 2005, 2006 by
- *  Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- *  02111-1307, USA.
- *
- * DESCRIPTION:
- *
- *-----------------------------------------------------------------------------*/
-
-#ifndef __I_SMP__
-#define __I_SMP__
-
-#include "SDL.h"
-
-#include "r_draw.h"
-
-typedef struct smp_item_s
-{
-  volatile int size;
-  volatile int index;
-  volatile int count;
-
-  union
-  {
-    void *item;
-    draw_column_vars_t* segs;
-    draw_span_vars_t* spans;
-  } data;
-} smp_item_t;
-
-extern int use_smp;
-extern int use_smp_default;
-
-void SMP_Init(void);
-void SMP_Free(void);
-
-void SMP_WakeRenderer(void);
-void SMP_FrontEndSleep(void);
-
-void SMP_ColFunc(draw_column_vars_t *data);
-void SMP_SpanFunc(draw_span_vars_t *data);
-
-#endif // __I_SMP__
diff --git a/src/m_fixed.h b/src/m_fixed.h
index 3654672..72052f5 100644
--- a/src/m_fixed.h
+++ b/src/m_fixed.h
@@ -116,4 +116,9 @@ inline static CONSTFUNC fixed_t FixedMod(fixed_t a, fixed_t b)
     return (a & (b-1));
 }
 
+static CONSTFUNC fixed_t Scale(fixed_t a, fixed_t b, fixed_t c)
+{
+	return (fixed_t)(((int_64_t)a*b)/c);
+}
+
 #endif
diff --git a/src/m_menu.c b/src/m_menu.c
index 86733f7..542cc06 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -3185,11 +3185,10 @@ setup_menu_t gen_settings4[] = { // General Settings screen3
   {"Flashing HOM indicator",     S_YESNO,  m_null, G_X, G_Y+10*8, {"flashing_hom"}},
 
   // prboom-plus 
-  {"Rendering quality",          S_CHOICE, m_null, G_X, G_Y+12*8, {"render_precise"}, 0, 0, M_ChangeRenderPrecise, render_precises},
-  {"Wipe Screen Effect",         S_YESNO,  m_null, G_X, G_Y+13*8, {"render_wipescreen"}},
-  {"Change Palette On Pain",     S_YESNO,  m_null, G_X, G_Y+15*8, {"palette_ondamage"}, 0, 0, M_ChangeApplyPalette},
-  {"Change Palette On Bonus",    S_YESNO,  m_null, G_X, G_Y+16*8, {"palette_onbonus"}, 0, 0, M_ChangeApplyPalette},
-  {"Change Palette On Powers",   S_YESNO,  m_null, G_X, G_Y+17*8, {"palette_onpowers"}, 0, 0, M_ChangeApplyPalette},
+  {"Wipe Screen Effect",         S_YESNO,  m_null, G_X, G_Y+12*8, {"render_wipescreen"}},
+  {"Change Palette On Pain",     S_YESNO,  m_null, G_X, G_Y+14*8, {"palette_ondamage"}, 0, 0, M_ChangeApplyPalette},
+  {"Change Palette On Bonus",    S_YESNO,  m_null, G_X, G_Y+15*8, {"palette_onbonus"}, 0, 0, M_ChangeApplyPalette},
+  {"Change Palette On Powers",   S_YESNO,  m_null, G_X, G_Y+16*8, {"palette_onpowers"}, 0, 0, M_ChangeApplyPalette},
 
   {"<- PREV",S_SKIP|S_PREV, m_null, KB_PREV, KB_Y+20*8, {gen_settings3}},
   {"NEXT ->",S_SKIP|S_NEXT,m_null,KB_NEXT,KB_Y+20*8, {gen_settings5}},
@@ -3251,6 +3250,7 @@ setup_menu_t gen_settings7[] =
   {"WALK UNDER SOLID HANGING BODIES"   ,S_YESNO     ,m_null,G_X2,G_Y+4*8, {"comperr_hangsolid"}},
   {"FIX CLIPPING PROBLEMS IN LARGE LEVELS" ,S_YESNO ,m_null,G_X2,G_Y+5*8, {"comperr_blockmap"}},
   {"ALLOW JUMP"                        ,S_YESNO     ,m_null,G_X2,G_Y+6*8, {"comperr_allowjump"}},
+  {"ALLOW VERTICAL AIMING"             ,S_YESNO     ,m_null,G_X2,G_Y+7*8, {"comperr_freeaim"}},
 
   {"<- PREV",S_SKIP|S_PREV,m_null,KB_PREV,KB_Y+20*8, {gen_settings6}},
 #ifdef GL_DOOM
diff --git a/src/m_misc.c b/src/m_misc.c
index 2d15718..990f0d5 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -48,8 +48,6 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 
-#include "i_smp.h"
-
 #include "doomstat.h"
 #include "m_argv.h"
 #include "g_game.h"
@@ -184,7 +182,6 @@ extern const char *gl_tex_format_string;
 extern int gl_sky_detail;
 extern int gl_use_paletted_texture;
 extern int gl_use_shared_texture_palette;
-extern int gl_seamless;
 
 //e6y: all OpenGL extentions will be disabled with TRUE
 extern int gl_compatibility;
@@ -242,7 +239,6 @@ default_t defaults[] =
   //e6y
   {"System settings",{NULL},{0},UL,UL,def_none,ss_none},
   {"process_priority", {&process_priority},{0},0,2,def_int,ss_none},
-  {"render_smp", {&use_smp_default},{0},0,1,def_bool,ss_none},
   {"try_to_reduce_cpu_cache_misses", {&try_to_reduce_cpu_cache_misses},{1},0,1,def_bool,ss_none},
   
   {"Misc settings",{NULL},{0},UL,UL,def_none,ss_none},
@@ -1007,8 +1003,6 @@ default_t defaults[] =
    def_int,ss_stat},
   {"render_interlaced_scanning", {&render_interlaced_scanning},  {0},0,1,
    def_bool,ss_stat},
-  {"render_precise",{(int*)&render_precise},{render_precise_quality},
-   render_precise_speed, render_precise_quality, def_int,ss_none},
   {"render_aspect", {&render_aspect},  {0},0,4,
    def_int,ss_stat},
   {"render_doom_lightmaps", {&render_doom_lightmaps},  {0},0,1,
@@ -1140,6 +1134,8 @@ default_t defaults[] =
    def_bool,ss_stat},
   {"comperr_allowjump", {&default_comperr[comperr_allowjump]},  {0},0,1,
    def_bool,ss_stat},
+  {"comperr_freeaim", {&default_comperr[comperr_freeaim]},  {0},0,1,
+   def_bool,ss_stat},
 
 #ifdef USE_WINDOWS_LAUNCHER
   {"Prboom-plus launcher settings",{NULL},{0},UL,UL,def_none,ss_none},
diff --git a/src/p_floor.c b/src/p_floor.c
index 3a413c8..11c14c0 100644
--- a/src/p_floor.c
+++ b/src/p_floor.c
@@ -84,8 +84,7 @@ result_e T_MovePlane
 #ifdef GL_DOOM
   if (V_GetMode() == VID_MODEGL)
   {
-    if (gl_seamless)
-      gld_UpdateSplitData(sector);
+    gld_UpdateSplitData(sector);
   }
 #endif
 
diff --git a/src/p_mobj.c b/src/p_mobj.c
index 45de4f5..24be98d 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -1626,6 +1626,9 @@ void P_SpawnPlayerMissile(mobj_t* source,mobjtype_t type)
       an = source->angle, slope = 0;
   }
       while (mask && (mask=0, !linetarget));  // killough 8/2/98
+
+      if (!linetarget && comperr(comperr_freeaim))
+        slope = finetangent[(ANG90 - source->pitch) >> ANGLETOFINESHIFT];
     }
 
   x = source->x;
diff --git a/src/p_pspr.c b/src/p_pspr.c
index d97038f..4bc09d7 100644
--- a/src/p_pspr.c
+++ b/src/p_pspr.c
@@ -44,6 +44,7 @@
 #include "sounds.h"
 #include "d_event.h"
 #include "r_demo.h"
+#include "g_game.h"
 #include "lprintf.h"
 #include "e6y.h"//e6y
 
@@ -737,6 +738,9 @@ static void P_BulletSlope(mobj_t *mo)
   bulletslope = P_AimLineAttack(mo, an -= 2<<26, 16*64*FRACUNIT, mask);
     }
   while (mask && (mask=0, !linetarget));  /* killough 8/2/98 */
+  
+  if (!linetarget && comperr(comperr_freeaim))
+    bulletslope = finetangent[(ANG90 - mo->pitch) >> ANGLETOFINESHIFT];
 }
 
 //
diff --git a/src/p_setup.c b/src/p_setup.c
index 7e3e12f..e80f71a 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -2162,19 +2162,19 @@ static int P_GroupLines (void)
     }
 
     // adjust bounding box to map blocks
-    block = (bbox[BOXTOP]-bmaporgy+MAXRADIUS)>>MAPBLOCKSHIFT;
+    block = P_GetSafeBlockY(bbox[BOXTOP]-bmaporgy+MAXRADIUS);
     block = block >= bmapheight ? bmapheight-1 : block;
     sector->blockbox[BOXTOP]=block;
 
-    block = (bbox[BOXBOTTOM]-bmaporgy-MAXRADIUS)>>MAPBLOCKSHIFT;
+    block = P_GetSafeBlockY(bbox[BOXBOTTOM]-bmaporgy-MAXRADIUS);
     block = block < 0 ? 0 : block;
     sector->blockbox[BOXBOTTOM]=block;
 
-    block = (bbox[BOXRIGHT]-bmaporgx+MAXRADIUS)>>MAPBLOCKSHIFT;
+    block = P_GetSafeBlockX(bbox[BOXRIGHT]-bmaporgx+MAXRADIUS);
     block = block >= bmapwidth ? bmapwidth-1 : block;
     sector->blockbox[BOXRIGHT]=block;
 
-    block = (bbox[BOXLEFT]-bmaporgx-MAXRADIUS)>>MAPBLOCKSHIFT;
+    block = P_GetSafeBlockX(bbox[BOXLEFT]-bmaporgx-MAXRADIUS);
     block = block < 0 ? 0 : block;
     sector->blockbox[BOXLEFT]=block;
   }
diff --git a/src/r_bsp.c b/src/r_bsp.c
index 28946d1..ccd7222 100644
--- a/src/r_bsp.c
+++ b/src/r_bsp.c
@@ -370,8 +370,8 @@ static void R_AddLine (seg_t *line)
 #ifdef GL_DOOM
   if (V_GetMode() == VID_MODEGL)
   {
-    angle1 = R_GetVertexViewAngleGL(line->v1);
-    angle2 = R_GetVertexViewAngleGL(line->v2);
+    angle1 = R_PointToPseudoAngle(line->v1->x, line->v1->y);
+    angle2 = R_PointToPseudoAngle(line->v2->x, line->v2->y);
 
     // Back side, i.e. backface culling	- read: endAngle >= startAngle!
     if (angle2 - angle1 < ANG180 || !line->linedef)  
@@ -425,8 +425,8 @@ static void R_AddLine (seg_t *line)
   }
 #endif
 
-  angle1 = R_GetVertexViewAngle(line->v1);
-  angle2 = R_GetVertexViewAngle(line->v2);
+  angle1 = R_PointToAngleEx(line->v1->px, line->v1->py);
+  angle2 = R_PointToAngleEx(line->v2->px, line->v2->py);
 
   // Clip to view edges.
   span = angle1 - angle2;
diff --git a/src/r_defs.h b/src/r_defs.h
index ccf5b0d..1120fd7 100644
--- a/src/r_defs.h
+++ b/src/r_defs.h
@@ -74,8 +74,6 @@
 typedef struct
 {
   fixed_t x, y;
-  angle_t viewangle;   // e6y: precalculated angle for clipping
-  int angletime;       // e6y: recalculation time for view angle 
   // [crispy] remove slime trails
   // pseudovertexes are dummies that have their coordinates modified to get
   // moved towards the linedef associated with their seg by projecting them
diff --git a/src/r_draw.h b/src/r_draw.h
index b012e75..b07c130 100644
--- a/src/r_draw.h
+++ b/src/r_draw.h
@@ -96,7 +96,6 @@ typedef struct draw_column_vars_s
   int                 drawingmasked;
   enum sloped_edge_type_e edgetype;
   unsigned int        flags; //e6y: for detect patches ind colfunc()
-  R_DrawColumn_f      colfunc;
 } draw_column_vars_t;
 
 void R_SetDefaultDrawColumnVars(draw_column_vars_t *dcvars);
diff --git a/src/r_fps.c b/src/r_fps.c
index f6ff7ab..aae4735 100644
--- a/src/r_fps.c
+++ b/src/r_fps.c
@@ -299,15 +299,12 @@ static void R_DoAnInterpolation (int i, fixed_t smoothratio)
   }
 
 #ifdef GL_DOOM
-  if (gl_seamless)
+  switch (curipos[i].type)
   {
-    switch (curipos[i].type)
-    {
-    case INTERP_SectorFloor:
-    case INTERP_SectorCeiling:
-      gld_UpdateSplitData(((sector_t*)curipos[i].address));
-      break;
-    }
+  case INTERP_SectorFloor:
+  case INTERP_SectorCeiling:
+    gld_UpdateSplitData(((sector_t*)curipos[i].address));
+    break;
   }
 #endif
 }
diff --git a/src/r_main.c b/src/r_main.c
index f38da14..778cd70 100644
--- a/src/r_main.c
+++ b/src/r_main.c
@@ -53,7 +53,6 @@
 #include "st_stuff.h"
 #include "i_main.h"
 #include "i_system.h"
-#include "i_smp.h"
 #include "g_game.h"
 #include "r_demo.h"
 #include "r_fps.h"
@@ -70,10 +69,6 @@ int render_doom_lightmaps;
 
 int r_frame_count;
 
-//e6y
-render_precise_t render_precise;
-const char *render_precises[] = {"Speed","Quality"};
-
 int r_have_internal_hires = false;
 
 // Fineangles in the SCREENWIDTH wide window.
@@ -95,7 +90,9 @@ int wide_offsety;
 int wide_offset2y;
 
 fixed_t  focallength;
+fixed_t  focallengthy;
 fixed_t  centerxfrac, centeryfrac;
+fixed_t  yaspectmul;
 fixed_t  viewheightfrac; //e6y: for correct cliping of things
 fixed_t  projection;
 // proff 11/06/98: Added for high-res
@@ -223,74 +220,45 @@ PUREFUNC int R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line)
 //
 // killough 5/2/98: reformatted, cleaned up
 
-angle_t R_PointToAngle(fixed_t x, fixed_t y)
+angle_t R_PointToAngleSlope(fixed_t x1, fixed_t y1, fixed_t x, fixed_t y, slope_div_fn slope_div)
 {
-  return (y -= viewy, (x -= viewx) || y) ?
+  return (y -= y1, (x -= x1) || y) ?
     x >= 0 ?
       y >= 0 ?
-        (x > y) ? tantoangle[SlopeDiv(y,x)] :                      // octant 0
-                ANG90-1-tantoangle[SlopeDiv(x,y)] :                // octant 1
-        x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] :                // octant 8
-                       ANG270+tantoangle[SlopeDiv(x,y)] :          // octant 7
-      y >= 0 ? (x = -x) > y ? ANG180-1-tantoangle[SlopeDiv(y,x)] : // octant 3
-                            ANG90 + tantoangle[SlopeDiv(x,y)] :    // octant 2
-        (x = -x) > (y = -y) ? ANG180+tantoangle[ SlopeDiv(y,x)] :  // octant 4
-                              ANG270-1-tantoangle[SlopeDiv(x,y)] : // octant 5
+        (x > y) ? tantoangle[slope_div(y,x)] :                      // octant 0
+                ANG90-1-tantoangle[slope_div(x,y)] :                // octant 1
+        x > (y = -y) ? 0-tantoangle[slope_div(y,x)] :               // octant 8
+                       ANG270+tantoangle[slope_div(x,y)] :          // octant 7
+      y >= 0 ? (x = -x) > y ? ANG180-1-tantoangle[slope_div(y,x)] : // octant 3
+                            ANG90 + tantoangle[slope_div(x,y)] :    // octant 2
+        (x = -x) > (y = -y) ? ANG180+tantoangle[slope_div(y,x)] :   // octant 4
+                              ANG270-1-tantoangle[slope_div(x,y)] : // octant 5
     0;
 }
 
-angle_t R_PointToAngle2(fixed_t viewx, fixed_t viewy, fixed_t x, fixed_t y)
+angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x, fixed_t y)
 {
-  return (y -= viewy, (x -= viewx) || y) ?
-    x >= 0 ?
-      y >= 0 ?
-        (x > y) ? tantoangle[SlopeDiv(y,x)] :                      // octant 0
-                ANG90-1-tantoangle[SlopeDiv(x,y)] :                // octant 1
-        x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] :                // octant 8
-                       ANG270+tantoangle[SlopeDiv(x,y)] :          // octant 7
-      y >= 0 ? (x = -x) > y ? ANG180-1-tantoangle[SlopeDiv(y,x)] : // octant 3
-                            ANG90 + tantoangle[SlopeDiv(x,y)] :    // octant 2
-        (x = -x) > (y = -y) ? ANG180+tantoangle[ SlopeDiv(y,x)] :  // octant 4
-                              ANG270-1-tantoangle[SlopeDiv(x,y)] : // octant 5
-    0;
+  return R_PointToAngleSlope(x1, y1, x, y, SlopeDiv);
 }
 
-// e6y
-// The precision of the code above is abysmal so use the CRT atan2 function instead!
-
-// FIXME - use of this function should be disabled on architectures with
-// poor floating point support! Imagine how slow this would be on ARM, say.
-
 angle_t R_PointToAngleEx(fixed_t x, fixed_t y)
 {
-  static int_64_t old_y_viewy;
-  static int_64_t old_x_viewx;
-  static int old_result;
-
-  int_64_t y_viewy = (int_64_t)y - viewy;
-  int_64_t x_viewx = (int_64_t)x - viewx;
+  // [crispy] fix overflows for very long distances
+  int64_t y_viewy = (int64_t)y - viewy;
+  int64_t x_viewx = (int64_t)x - viewx;
 
-  if (!render_precise)
+  // [crispy] the worst that could happen is e.g. INT_MIN-INT_MAX = 2*INT_MIN
+  if (x_viewx < INT_MIN || x_viewx > INT_MAX ||y_viewy < INT_MIN || y_viewy > INT_MAX)
   {
-    // e6y: here is where "slime trails" can SOMETIMES occur
-#ifdef GL_DOOM
-    if (V_GetMode() != VID_MODEGL)
-#endif
-      if (y_viewy < INT_MAX/4 && x_viewx < INT_MAX/4
-          && y_viewy > -INT_MAX/4 && x_viewx > -INT_MAX/4)
-        return R_PointToAngle(x, y);
+    // [crispy] preserving the angle by halfing the distance in both directions
+    x = (int)(x_viewx / 2 + viewx);
+    y = (int)(y_viewy / 2 + viewy);
   }
 
-  if (old_y_viewy != y_viewy || old_x_viewx != x_viewx)
-  {
-    old_y_viewy = y_viewy;
-    old_x_viewx = x_viewx;
-
-    old_result = (int)((float)atan2((float)y_viewy, (float)x_viewx) * (ANG180/M_PI));
-  }
-  return old_result;
+  return R_PointToAngleSlope(viewx, viewy, x, y, SlopeDivEx);
 }
 
+
 //-----------------------------------------------------------------------------
 //
 // ! Returns the pseudoangle between the line p1 to (infinity, p1.y) and the 
@@ -325,29 +293,6 @@ angle_t R_PointToPseudoAngle (fixed_t x, fixed_t y)
   }
 }
 
-angle_t R_GetVertexViewAngleGL(vertex_t *v)
-{
-  if (v->angletime != r_frame_count)
-  {
-    v->angletime = r_frame_count;
-    v->viewangle = R_PointToPseudoAngle(v->x, v->y);
-  }
-  return v->viewangle;
-}
-
-
-// e6y: caching
-angle_t R_GetVertexViewAngle(vertex_t *v)
-{
-  if (v->angletime != r_frame_count)
-  {
-    v->angletime = r_frame_count;
-    v->viewangle = R_PointToAngleEx(v->px, v->py);
-  }
-  return v->viewangle;
-}
-
-
 //
 // R_InitTextureMapping
 //
@@ -375,6 +320,7 @@ static void R_InitTextureMapping (void)
   //  so FIELDOFVIEW angles covers SCREENWIDTH.
 
   focallength = FixedDiv(centerxfrac, finetangent[FINEANGLES/4 + FieldOfView/2]);
+  focallengthy = Scale(centerxfrac, yaspectmul, finetangent[FINEANGLES/4 + FieldOfView/2]);
 
   for (i=0 ; i<FINEANGLES/2 ; i++)
     {
@@ -958,7 +904,7 @@ void R_SetupFreelook(void)
     centery = viewheight / 2;
     if (GetMouseLook())
     {
-      dy = FixedMul(focallength, finetangent[(ANG90-viewpitch)>>ANGLETOFINESHIFT]);
+      dy = FixedMul(focallengthy, finetangent[(ANG90-viewpitch)>>ANGLETOFINESHIFT]);
       centery += dy >> FRACBITS;
     }
     centeryfrac = centery<<FRACBITS;
@@ -1155,24 +1101,16 @@ void R_RenderPlayerView (player_t* player)
   }
 #endif
 
-  SMP_WakeRenderer();
-
   // The head node is the last node output.
   R_RenderBSPNode (numnodes-1);
 
 #ifdef HAVE_NET
-  if (!use_smp)
-  {
-    NetUpdate ();
-  }
+  NetUpdate ();
 #endif
 
   if (V_GetMode() != VID_MODEGL)
     R_DrawPlanes();
 
-  // sleep until the renderer has completed
-  SMP_FrontEndSleep();
-
   R_ResetColumnBuffer();
 
   // Check for new console commands.
diff --git a/src/r_main.h b/src/r_main.h
index 56d2423..0c02810 100644
--- a/src/r_main.h
+++ b/src/r_main.h
@@ -57,6 +57,7 @@ extern int      centerx;
 extern int      centery;
 extern fixed_t  centerxfrac;
 extern fixed_t  centeryfrac;
+extern fixed_t  yaspectmul;
 extern fixed_t  viewheightfrac; //e6y: for correct cliping of things
 extern fixed_t  projection;
 extern fixed_t  skyiscale;
@@ -139,22 +140,13 @@ extern const lighttable_t *fixedcolormap;
 
 PUREFUNC int R_PointOnSide(fixed_t x, fixed_t y, const node_t *node);
 PUREFUNC int R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line);
-angle_t R_PointToAngle(fixed_t x, fixed_t y);
-angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2);
+angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x, fixed_t y);
 subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);
 
 //e6y: made more precise
 angle_t R_PointToAngleEx(fixed_t x, fixed_t y);
-//e6y: caching
-angle_t R_GetVertexViewAngle(vertex_t *v);
-angle_t R_GetVertexViewAngleGL(vertex_t *v);
 angle_t R_PointToPseudoAngle(fixed_t x, fixed_t y);
 
-//e6y
-typedef enum { render_precise_speed, render_precise_quality } render_precise_t;
-extern render_precise_t render_precise;
-extern const char *render_precises[];
-
 extern int r_have_internal_hires;
 
 //
diff --git a/src/r_plane.c b/src/r_plane.c
index c100815..0b101f6 100644
--- a/src/r_plane.c
+++ b/src/r_plane.c
@@ -48,8 +48,6 @@
 #include "config.h"
 #endif
 
-#include "i_smp.h"
-
 #include "z_zone.h"  /* memory allocation wrappers -- killough */
 
 #include "doomstat.h"
@@ -224,7 +222,7 @@ static void R_MapPlane(int y, int x1, int x2, draw_span_vars_t *dsvars)
   dsvars->x2 = x2;
 
   if (V_GetMode() != VID_MODEGL)
-    SMP_SpanFunc(dsvars);
+    R_DrawSpan(dsvars);
 }
 
 //
@@ -481,8 +479,7 @@ static void R_DoDrawPlane(visplane_t *pl)
               dcvars.source = R_GetTextureColumn(tex_patch, ((an + xtoviewangle[x])^flip) >> ANGLETOSKYSHIFT);
               dcvars.prevsource = R_GetTextureColumn(tex_patch, ((an + xtoviewangle[x-1])^flip) >> ANGLETOSKYSHIFT);
               dcvars.nextsource = R_GetTextureColumn(tex_patch, ((an + xtoviewangle[x+1])^flip) >> ANGLETOSKYSHIFT);
-              dcvars.colfunc = colfunc;
-              SMP_ColFunc(&dcvars);
+              colfunc(&dcvars);
             }
 
       R_UnlockTextureCompositePatchNum(texture);
diff --git a/src/r_segs.c b/src/r_segs.c
index 8722fcc..cff502c 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -47,7 +47,6 @@
 #include "r_draw.h"
 #include "w_wad.h"
 #include "v_video.h"
-#include "i_smp.h"
 #include "lprintf.h"
 
 // OPTIMIZE: closed two sided lines as single sided
@@ -514,8 +513,7 @@ static void R_RenderSegLoop (void)
           dcvars.prevsource = R_GetTextureColumn(tex_patch, texturecolumn-1);
           dcvars.nextsource = R_GetTextureColumn(tex_patch, texturecolumn+1);
           dcvars.texheight = midtexheight;
-          dcvars.colfunc = colfunc;
-          SMP_ColFunc(&dcvars);
+          colfunc(&dcvars);
           R_UnlockTextureCompositePatchNum(midtexture);
           tex_patch = NULL;
           ceilingclip[rw_x] = viewheight;
@@ -544,8 +542,7 @@ static void R_RenderSegLoop (void)
                   dcvars.prevsource = R_GetTextureColumn(tex_patch,texturecolumn-1);
                   dcvars.nextsource = R_GetTextureColumn(tex_patch,texturecolumn+1);
                   dcvars.texheight = toptexheight;
-                  dcvars.colfunc = colfunc;
-                  SMP_ColFunc(&dcvars);
+                  colfunc(&dcvars);
                   R_UnlockTextureCompositePatchNum(toptexture);
                   tex_patch = NULL;
                   ceilingclip[rw_x] = mid;
@@ -579,8 +576,7 @@ static void R_RenderSegLoop (void)
                   dcvars.prevsource = R_GetTextureColumn(tex_patch, texturecolumn-1);
                   dcvars.nextsource = R_GetTextureColumn(tex_patch, texturecolumn+1);
                   dcvars.texheight = bottomtexheight;
-                  dcvars.colfunc = colfunc;
-                  SMP_ColFunc(&dcvars);
+                  colfunc(&dcvars);
                   R_UnlockTextureCompositePatchNum(bottomtexture);
                   tex_patch = NULL;
                   floorclip[rw_x] = mid;
@@ -638,7 +634,7 @@ static fixed_t R_PointToDist(fixed_t x, fixed_t y)
 void R_StoreWallRange(const int start, const int stop)
 {
   const int shift_bits = 1;
-  int_64_t dx, dy, dx1, dy1, len;
+  int_64_t dx, dy, dx1, dy1, len, dist;
 
   if (ds_p == drawsegs+maxdrawsegs)   // killough 1/98 -- fix 2s line HOM
     {
@@ -680,13 +676,14 @@ void R_StoreWallRange(const int start, const int stop)
 
   // [Linguica] Fix long wall error
   // shift right to avoid possibility of int64 overflow in rw_distance calculation
-  dx = (curline->v2->px - curline->v1->px) >> shift_bits;
-  dy = (curline->v2->py - curline->v1->py) >> shift_bits;
-  dx1 = (viewx - curline->v1->px) >> shift_bits;
-  dy1 = (viewy - curline->v1->py) >> shift_bits;
+  dx = ((int_64_t)curline->v2->px - curline->v1->px) >> shift_bits;
+  dy = ((int_64_t)curline->v2->py - curline->v1->py) >> shift_bits;
+  dx1 = ((int_64_t)viewx - curline->v1->px) >> shift_bits;
+  dy1 = ((int_64_t)viewy - curline->v1->py) >> shift_bits;
   len = curline->length >> shift_bits;
   
-  rw_distance = (fixed_t)(((dy * dx1 - dx * dy1) / len) << shift_bits);
+  dist = (((dy * dx1 - dx * dy1) / len) << shift_bits);
+  rw_distance = (fixed_t)BETWEEN(INT_MIN, INT_MAX, dist);
 
   ds_p->x1 = rw_x = start;
   ds_p->x2 = stop;
diff --git a/src/r_things.c b/src/r_things.c
index f90c266..223c5e6 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -691,7 +691,7 @@ static void R_ProjectSprite (mobj_t* thing)
     {
       // choose a different rotation based on player view
       angle_t rot;
-      angle_t ang = R_PointToAngle(fx, fy);
+      angle_t ang = R_PointToAngle2(viewx, viewy, fx, fy);
       if (sprframe->lump[0] == sprframe->lump[1])
       {
         rot = (ang - thing->angle + (angle_t)(ANG45/2)*9) >> 28;
diff --git a/src/tables.c b/src/tables.c
index 2cf59e1..4322954 100644
--- a/src/tables.c
+++ b/src/tables.c
@@ -55,7 +55,7 @@
 
 // killough 5/3/98: reformatted
 
-int SlopeDiv(unsigned num, unsigned den)
+int SlopeDiv(unsigned int num, unsigned int den)
 {
   unsigned ans;
 
@@ -65,6 +65,16 @@ int SlopeDiv(unsigned num, unsigned den)
   return ans <= SLOPERANGE ? ans : SLOPERANGE;
 }
 
+// [crispy] catch SlopeDiv overflows, only used in rendering
+int SlopeDivEx(unsigned int num, unsigned int den)
+{
+  uint_64_t ans;
+  if (den < 512)
+    return SLOPERANGE;
+  ans = ((uint_64_t)num<<3)/(den>>8);
+  return ans <= SLOPERANGE ? (int)ans : SLOPERANGE;
+}
+
 fixed_t finetangent[4096];
 
 //const fixed_t *const finecosine = &finesine[FINEANGLES/4];
diff --git a/src/tables.h b/src/tables.h
index 5282556..8510e81 100644
--- a/src/tables.h
+++ b/src/tables.h
@@ -90,6 +90,8 @@ extern fixed_t finetangent[FINEANGLES/2];
 extern angle_t tantoangle[SLOPERANGE+1];
 
 // Utility function, called by R_PointToAngle.
-int SlopeDiv(unsigned num, unsigned den);
+typedef int (*slope_div_fn)(unsigned int num, unsigned int den);
+int SlopeDiv(unsigned int num, unsigned int den);
+int SlopeDivEx(unsigned int num, unsigned int den);
 
 #endif
diff --git a/src/v_video.c b/src/v_video.c
index 1e6cab2..c1ecbd0 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -983,10 +983,7 @@ static void V_PlotPixelWuGL(int scrn, int x, int y, byte color, int weight) {
 }
 static void WRAP_gld_DrawLine(fline_t* fl, int color)
 {
-  if (render_precise)
-    gld_DrawLine_f(fl->a.fx, fl->a.fy, fl->b.fx, fl->b.fy, color);
-  else
-    gld_DrawLine(fl->a.x, fl->a.y, fl->b.x, fl->b.y, color);
+  gld_DrawLine_f(fl->a.fx, fl->a.fy, fl->b.fx, fl->b.fy, color);
 }
 #endif
 
@@ -1659,6 +1656,8 @@ void SetRatio(int width, int height)
   WIDE_SCREENWIDTH = MAX(1, WIDE_SCREENWIDTH);
   WIDE_SCREENHEIGHT = MAX(1, WIDE_SCREENHEIGHT);
 
+  yaspectmul = Scale((320<<FRACBITS), WIDE_SCREENHEIGHT, 200 * WIDE_SCREENWIDTH);
+
   patches_scalex = MIN(SCREENWIDTH / 320, SCREENHEIGHT / 200);
   patches_scalex = MAX(1, patches_scalex);
   patches_scaley = patches_scalex;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/prboom+.git



More information about the Pkg-games-commits mailing list