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

Fabian Greffrath fabian-guest at moszumanska.debian.org
Thu Feb 19 14:06:11 UTC 2015


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

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

commit 2c4ea94f90e5846185fb6dd89691821dc3d04d61
Author: Fabian Greffrath <fabian+debian at greffrath.com>
Date:   Thu Feb 19 15:05:59 2015 +0100

    Imported Upstream version 2.5.1.4~svn4417+dfsg1
---
 src/SDL/i_joy.c   |  4 ++--
 src/SDL/i_sound.c |  1 -
 src/am_map.c      |  7 +------
 src/g_overflow.c  |  2 ++
 src/g_overflow.h  |  5 +++--
 src/hu_lib.c      | 19 +++++++++++++++----
 src/hu_stuff.c    |  9 ++++++++-
 src/m_menu.c      |  2 +-
 src/p_setup.c     | 41 ++++++++++++++++++++++++++++++++++-------
 src/r_defs.h      |  8 ++++++++
 src/r_main.c      |  2 +-
 src/r_segs.c      | 19 +++++++++++++------
 src/r_things.c    | 10 +++++-----
 src/r_things.h    |  2 +-
 14 files changed, 94 insertions(+), 37 deletions(-)

diff --git a/src/SDL/i_joy.c b/src/SDL/i_joy.c
index bf71470..cf44405 100644
--- a/src/SDL/i_joy.c
+++ b/src/SDL/i_joy.c
@@ -80,10 +80,10 @@ void I_PollJoystick(void)
     (SDL_JoystickGetButton(joystick, 6)<<6) |
     (SDL_JoystickGetButton(joystick, 7)<<7);
   axis_value = SDL_JoystickGetAxis(joystick, 0) / 3000;
-  if (abs(axis_value)<10) axis_value=0;
+  if (abs(axis_value)<7) axis_value=0;
   ev.data2 = axis_value;
   axis_value = SDL_JoystickGetAxis(joystick, 1) / 3000;
-  if (abs(axis_value)<10) axis_value=0;
+  if (abs(axis_value)<7) axis_value=0;
   ev.data3 = axis_value;
 
   D_PostEvent(&ev);
diff --git a/src/SDL/i_sound.c b/src/SDL/i_sound.c
index d2344dd..2ba9a8f 100644
--- a/src/SDL/i_sound.c
+++ b/src/SDL/i_sound.c
@@ -158,7 +158,6 @@ static void stopchan(int i)
   if (channelinfo[i].data) /* cph - prevent excess unlocks */
   {
     channelinfo[i].data = NULL;
-    W_UnlockLumpNum(S_sfx[channelinfo[i].id].lumpnum);
   }
 }
 
diff --git a/src/am_map.c b/src/am_map.c
index 91c0edd..0138a01 100644
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -634,12 +634,6 @@ static void AM_LevelInit(void)
 
   AM_SetPosition();
   AM_SetScale();
-
-  AM_findMinMaxBoundaries();
-  scale_mtof = FixedDiv(min_scale_mtof, (int) (0.7*FRACUNIT));
-  if (scale_mtof > max_scale_mtof)
-    scale_mtof = min_scale_mtof;
-  scale_ftom = FixedDiv(FRACUNIT, scale_mtof);
 }
 
 //
@@ -682,6 +676,7 @@ void AM_Start(void)
     lastlevel = gamemap;
     lastepisode = gameepisode;
   }
+  AM_SetPosition();
   AM_initVariables();
   AM_loadPics();
 }
diff --git a/src/g_overflow.c b/src/g_overflow.c
index 7e6c00d..fd43263 100644
--- a/src/g_overflow.c
+++ b/src/g_overflow.c
@@ -46,6 +46,8 @@
 #include "m_misc.h"
 #include "e6y.h"
 
+int overflows_enabled = true;
+
 overrun_param_t overflows[OVERFLOW_MAX];
 const char *overflow_cfgname[OVERFLOW_MAX] =
 {
diff --git a/src/g_overflow.h b/src/g_overflow.h
index 0d67f8a..27a61b5 100644
--- a/src/g_overflow.h
+++ b/src/g_overflow.h
@@ -60,11 +60,12 @@ typedef enum overrun_list_s
   OVERFLOW_MAX //last
 } overrun_list_t;
 
+extern int overflows_enabled;
 extern overrun_param_t overflows[];
 extern const char *overflow_cfgname[OVERFLOW_MAX];
 
-#define EMULATE(overflow) (overflows[overflow].footer ? overflows[overflow].footer_emulate : overflows[overflow].emulate)
-#define PROCESS(overflow) (overflows[overflow].warn || EMULATE(overflow))
+#define EMULATE(overflow) (overflows_enabled && (overflows[overflow].footer ? overflows[overflow].footer_emulate : overflows[overflow].emulate))
+#define PROCESS(overflow) (overflows_enabled && (overflows[overflow].warn || EMULATE(overflow)))
 
 // e6y
 //
diff --git a/src/hu_lib.c b/src/hu_lib.c
index 2b7aa46..45b3b8a 100644
--- a/src/hu_lib.c
+++ b/src/hu_lib.c
@@ -237,7 +237,6 @@ void HUlib_drawTextLine
 //
 void HUlib_eraseTextLine(hu_textline_t* l)
 {
-  int lh;
   int y;
 
   // Only erases when NOT in automap and the screen is reduced,
@@ -246,9 +245,21 @@ void HUlib_eraseTextLine(hu_textline_t* l)
 
   if (!(automapmode & am_active) && viewwindowx && l->needsupdate)
   {
-    lh = l->f[0].height + 1;
-    for (y=l->y; y<l->y+lh ; y++)
-      {
+    int top = l->y;
+    int bottom = l->y + l->f[0].height - 1;
+
+    top = BETWEEN(0, 200-1, top);
+    bottom = BETWEEN(0, 200-1, bottom);
+
+    if (l->flags & VPT_STRETCH_MASK)
+    {
+      stretch_param_t *params = &stretch_params[l->flags & VPT_ALIGN_MASK];
+      top = params->video->y1lookup[top] + params->deltay1;
+      bottom = params->video->y2lookup[bottom] + params->deltay1;
+    }
+
+    for (y=top; y<=bottom; y++)
+    {
       if (y < viewwindowy || y >= viewwindowy + viewheight)
         R_VideoErase(0, y, SCREENWIDTH); // erase entire line
       else
diff --git a/src/hu_stuff.c b/src/hu_stuff.c
index ebe190f..175a46e 100644
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -52,6 +52,7 @@
 #include "r_main.h"
 #include "lprintf.h"
 #include "e6y.h" //e6y
+#include "g_overflow.h"
 
 // global heads up display controls
 
@@ -2245,7 +2246,13 @@ void HU_draw_crosshair(void)
 
   if (hudadd_crosshair_target || hudadd_crosshair_lock_target)
   {
-    fixed_t slope = P_AimLineAttack(plr->mo, plr->mo->angle, 16*64*FRACUNIT, 0);
+    fixed_t slope;
+    
+    // intercepts overflow guard
+    overflows_enabled = false;
+    slope = P_AimLineAttack(plr->mo, plr->mo->angle, 16*64*FRACUNIT, 0);
+    overflows_enabled = true;
+
     if (linetarget && !(linetarget->flags & MF_SHADOW))
     {
       crosshair.target_x = linetarget->x;
diff --git a/src/m_menu.c b/src/m_menu.c
index 5ed85ca..86733f7 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -5963,7 +5963,7 @@ void M_WriteText (int x,int y, const char* string, int cm)
     }
 
     w = hu_font[c].width;
-    if (cx+w > SCREENWIDTH)
+    if (cx+w > BASE_WIDTH)
       break;
     // proff/nicolas 09/20/98 -- changed for hi-res
     // CPhipps - patch drawing updated
diff --git a/src/p_setup.c b/src/p_setup.c
index 0ef5f07..83dae41 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -2232,6 +2232,17 @@ static void P_RemoveSlimeTrails(void)         // killough 10/98
 {
   byte *hit = calloc(1, numvertexes);         // Hitlist for vertices
   int i;
+  // Correction of desync on dv04-423.lmp/dv.wad
+  // http://www.doomworld.com/vb/showthread.php?s=&postid=627257#post627257
+  int apply_for_real_vertexes = (compatibility_level>=lxdoom_1_compatibility || prboom_comp[PC_REMOVE_SLIME_TRAILS].state);
+
+  for (i=0; i<numvertexes; i++)
+  {
+    // [crispy] initialize pseudovertexes with actual vertex coordinates
+    vertexes[i].px = vertexes[i].x;
+    vertexes[i].py = vertexes[i].y;
+  }
+
   for (i=0; i<numsegs; i++)                   // Go through each seg
   {
     const line_t *l;
@@ -2254,8 +2265,13 @@ static void P_RemoveSlimeTrails(void)         // killough 10/98
         int_64_t dxy = (l->dx >> FRACBITS) * (l->dy >> FRACBITS);
         int_64_t s = dx2 + dy2;
         int x0 = v->x, y0 = v->y, x1 = l->v1->x, y1 = l->v1->y;
-        v->x = (int)((dx2 * x0 + dy2 * x1 + dxy * (y0 - y1)) / s);
-        v->y = (int)((dy2 * y0 + dx2 * y1 + dxy * (x0 - x1)) / s);
+        v->px = (int)((dx2 * x0 + dy2 * x1 + dxy * (y0 - y1)) / s);
+        v->py = (int)((dy2 * y0 + dx2 * y1 + dxy * (x0 - x1)) / s);
+        if (apply_for_real_vertexes)
+        {
+          v->x = v->px;
+          v->y = v->py;
+        }
       }
         }  // Obsfucated C contest entry:   :)
     while ((v != segs[i].v2) && (v = segs[i].v2));
@@ -2264,6 +2280,18 @@ static void P_RemoveSlimeTrails(void)         // killough 10/98
   free(hit);
 }
 
+static void R_CalcSegsLength(void)
+{
+  int i;
+  for (i=0; i<numsegs; i++)
+  {
+    seg_t *li = segs+i;
+    fixed_t dx = li->v2->px - li->v1->px;
+    fixed_t dy = li->v2->py - li->v1->py;
+    li->length = (fixed_t)sqrt((double)dx*dx + (double)dy*dy);
+  }
+}
+
 //
 // P_CheckLumpsForSameSource
 //
@@ -2625,11 +2653,10 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill)
   // P_GroupLines modified to return a number the underflow padding needs
   P_LoadReject(lumpnum, P_GroupLines());
 
-  // e6y
-  // Correction of desync on dv04-423.lmp/dv.wad
-  // http://www.doomworld.com/vb/showthread.php?s=&postid=627257#post627257
-  if (compatibility_level>=lxdoom_1_compatibility || prboom_comp[PC_REMOVE_SLIME_TRAILS].state)
-    P_RemoveSlimeTrails();    // killough 10/98: remove slime trails from wad
+  P_RemoveSlimeTrails();    // killough 10/98: remove slime trails from wad
+
+  // should be after P_RemoveSlimeTrails, because it changes vertexes
+  R_CalcSegsLength();
 
   // Note: you don't need to clear player queue slots --
   // a much simpler fix is in g_game.c -- killough 10/98
diff --git a/src/r_defs.h b/src/r_defs.h
index 60059aa..064b847 100644
--- a/src/r_defs.h
+++ b/src/r_defs.h
@@ -76,6 +76,13 @@ 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
+  // using the law of cosines in p_setup.c:P_RemoveSlimeTrails();
+  // they are *only* used in rendering
+  fixed_t px;
+  fixed_t py;
 } vertex_t;
 
 // Each sector has a degenmobj_t in its center for sound origin purposes.
@@ -278,6 +285,7 @@ typedef struct
   vertex_t *v1, *v2;
   fixed_t offset;
   angle_t angle;
+  fixed_t length;
   side_t* sidedef;
   line_t* linedef;
 
diff --git a/src/r_main.c b/src/r_main.c
index fb0efc5..a2165e9 100644
--- a/src/r_main.c
+++ b/src/r_main.c
@@ -342,7 +342,7 @@ angle_t R_GetVertexViewAngle(vertex_t *v)
   if (v->angletime != r_frame_count)
   {
     v->angletime = r_frame_count;
-    v->viewangle = R_PointToAngleEx(v->x, v->y);
+    v->viewangle = R_PointToAngleEx(v->px, v->py);
   }
   return v->viewangle;
 }
diff --git a/src/r_segs.c b/src/r_segs.c
index 372b8ba..ba5df64 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -365,7 +365,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2)
           if (t + (int_64_t) textureheight[texnum] * spryscale < 0 ||
               t > (int_64_t) SCREENHEIGHT << FRACBITS*2)
             continue;        // skip if the texture is out of screen's range
-          sprtopscreen = (long)(t >> FRACBITS);
+          sprtopscreen = (int_64_t)(t >> FRACBITS);
         }
 
         dcvars.iscale = 0xffffffffu / (unsigned) spryscale;
@@ -637,7 +637,8 @@ static fixed_t R_PointToDist(fixed_t x, fixed_t y)
 //
 void R_StoreWallRange(const int start, const int stop)
 {
-  fixed_t hyp;
+  const int shift_bits = 1;
+  int_64_t dx, dy, dx1, dy1, len;
   angle_t offsetangle;
 
   if (ds_p == drawsegs+maxdrawsegs)   // killough 1/98 -- fix 2s line HOM
@@ -683,9 +684,15 @@ void R_StoreWallRange(const int start, const int stop)
   if (D_abs(offsetangle) > ANG90)
     offsetangle = ANG90;
 
-  hyp = (viewx==curline->v1->x && viewy==curline->v1->y)?
-    0 : R_PointToDist (curline->v1->x, curline->v1->y);
-  rw_distance = FixedMul(hyp, finecosine[offsetangle>>ANGLETOFINESHIFT]);
+  // [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;
+  len = curline->length >> shift_bits;
+  
+  rw_distance = (fixed_t)(((dy * dx1 - dx * dy1) / len) << shift_bits);
 
   ds_p->x1 = rw_x = start;
   ds_p->x2 = stop;
@@ -898,7 +905,7 @@ void R_StoreWallRange(const int start, const int stop)
 
   if (segtextured)
     {
-      rw_offset = FixedMul (hyp, -finesine[offsetangle >>ANGLETOFINESHIFT]);
+      rw_offset = (fixed_t)(((dx * dx1 + dy * dy1) / len) << shift_bits);
 
       rw_offset += sidedef->textureoffset + curline->offset;
 
diff --git a/src/r_things.c b/src/r_things.c
index 9a3ec86..f900a3e 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -441,7 +441,7 @@ static vissprite_t *R_NewVisSprite(void)
 int   *mfloorclip;   // dropoff overflow
 int   *mceilingclip; // dropoff overflow
 fixed_t spryscale;
-fixed_t sprtopscreen;
+int_64_t sprtopscreen;
 
 void R_DrawMaskedColumn(
   const rpatch_t *patch,
@@ -453,8 +453,8 @@ void R_DrawMaskedColumn(
 )
 {
   int     i;
-  int     topscreen;
-  int     bottomscreen;
+  int_64_t     topscreen;
+  int_64_t     bottomscreen;
   fixed_t basetexturemid = dcvars->texturemid;
 
   dcvars->texheight = patch->height; // killough 11/98
@@ -465,8 +465,8 @@ void R_DrawMaskedColumn(
       topscreen = sprtopscreen + spryscale*post->topdelta;
       bottomscreen = topscreen + spryscale*post->length;
 
-      dcvars->yl = (topscreen+FRACUNIT-1)>>FRACBITS;
-      dcvars->yh = (bottomscreen-1)>>FRACBITS;
+      dcvars->yl = (int)((topscreen+FRACUNIT-1)>>FRACBITS);
+      dcvars->yh = (int)((bottomscreen-1)>>FRACBITS);
 
       if (dcvars->yh >= mfloorclip[dcvars->x])
         dcvars->yh = mfloorclip[dcvars->x]-1;
diff --git a/src/r_things.h b/src/r_things.h
index 587b239..51ccc02 100644
--- a/src/r_things.h
+++ b/src/r_things.h
@@ -55,7 +55,7 @@ extern int *screenheightarray; /* change to MAX_*  */ // dropoff overflow
 extern int     *mfloorclip;    // dropoff overflow
 extern int     *mceilingclip;  // dropoff overflow
 extern fixed_t spryscale;
-extern fixed_t sprtopscreen;
+extern int_64_t sprtopscreen;
 extern fixed_t pspriteiscale;
 /* proff 11/06/98: Added for high-res */
 extern fixed_t pspritexscale;

-- 
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