2006-02-24 04:48:15 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// All the clipping: columns, horizontal spans, sky columns.
|
|
|
|
//
|
|
|
|
// This file contains some code from the Build Engine.
|
|
|
|
//
|
|
|
|
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
|
|
|
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
|
|
|
// See the included license file "BUILDLIC.TXT" for license info.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
#include "templates.h"
|
|
|
|
#include "i_system.h"
|
|
|
|
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "doomstat.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "doomdata.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "p_lnspec.h"
|
|
|
|
|
|
|
|
#include "r_local.h"
|
|
|
|
#include "r_sky.h"
|
|
|
|
#include "v_video.h"
|
|
|
|
|
|
|
|
#include "m_swap.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "stats.h"
|
2006-04-12 01:50:09 +00:00
|
|
|
#include "a_sharedglobal.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "d_net.h"
|
|
|
|
#include "g_level.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
#include "r_bsp.h"
|
|
|
|
#include "r_plane.h"
|
|
|
|
#include "r_segs.h"
|
2011-01-29 11:09:38 +00:00
|
|
|
#include "r_3dfloors.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
#include "v_palette.h"
|
2011-07-06 07:35:36 +00:00
|
|
|
#include "r_data/colormaps.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
#define WALLYREPEAT 8
|
|
|
|
|
2010-05-12 06:52:03 +00:00
|
|
|
|
2012-04-23 02:38:09 +00:00
|
|
|
CVAR(Bool, r_np2, true, 0)
|
|
|
|
|
2007-04-29 12:07:27 +00:00
|
|
|
//CVAR (Int, ty, 8, 0)
|
|
|
|
//CVAR (Int, tx, 8, 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
#define HEIGHTBITS 12
|
|
|
|
#define HEIGHTSHIFT (FRACBITS-HEIGHTBITS)
|
|
|
|
|
|
|
|
extern fixed_t globaluclip, globaldclip;
|
|
|
|
|
|
|
|
|
|
|
|
// OPTIMIZE: closed two sided lines as single sided
|
|
|
|
|
|
|
|
// killough 1/6/98: replaced globals with statics where appropriate
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
static bool segtextured; // True if any of the segs textures might be visible.
|
2006-02-24 04:48:15 +00:00
|
|
|
bool markfloor; // False if the back side is the same plane.
|
|
|
|
bool markceiling;
|
|
|
|
FTexture *toptexture;
|
|
|
|
FTexture *bottomtexture;
|
|
|
|
FTexture *midtexture;
|
2008-03-21 17:35:49 +00:00
|
|
|
fixed_t rw_offset_top;
|
|
|
|
fixed_t rw_offset_mid;
|
|
|
|
fixed_t rw_offset_bottom;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
int wallshade;
|
|
|
|
|
|
|
|
short walltop[MAXWIDTH]; // [RH] record max extents of wall
|
|
|
|
short wallbottom[MAXWIDTH];
|
|
|
|
short wallupper[MAXWIDTH];
|
|
|
|
short walllower[MAXWIDTH];
|
|
|
|
fixed_t swall[MAXWIDTH];
|
|
|
|
fixed_t lwall[MAXWIDTH];
|
2007-04-29 12:07:27 +00:00
|
|
|
fixed_t lwallscale;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// regular wall
|
|
|
|
//
|
|
|
|
extern fixed_t rw_backcz1, rw_backcz2;
|
|
|
|
extern fixed_t rw_backfz1, rw_backfz2;
|
|
|
|
extern fixed_t rw_frontcz1, rw_frontcz2;
|
|
|
|
extern fixed_t rw_frontfz1, rw_frontfz2;
|
|
|
|
|
|
|
|
int rw_ceilstat, rw_floorstat;
|
|
|
|
bool rw_mustmarkfloor, rw_mustmarkceiling;
|
|
|
|
bool rw_prepped;
|
|
|
|
bool rw_markmirror;
|
|
|
|
bool rw_havehigh;
|
|
|
|
bool rw_havelow;
|
|
|
|
|
|
|
|
fixed_t rw_light; // [RH] Scale lights with viewsize adjustments
|
|
|
|
fixed_t rw_lightstep;
|
|
|
|
fixed_t rw_lightleft;
|
|
|
|
|
|
|
|
static fixed_t rw_frontlowertop;
|
|
|
|
|
|
|
|
static int rw_x;
|
|
|
|
static int rw_stopx;
|
|
|
|
fixed_t rw_offset;
|
|
|
|
static fixed_t rw_scalestep;
|
|
|
|
static fixed_t rw_midtexturemid;
|
|
|
|
static fixed_t rw_toptexturemid;
|
|
|
|
static fixed_t rw_bottomtexturemid;
|
2009-06-07 01:14:14 +00:00
|
|
|
static fixed_t rw_midtexturescalex;
|
|
|
|
static fixed_t rw_midtexturescaley;
|
|
|
|
static fixed_t rw_toptexturescalex;
|
|
|
|
static fixed_t rw_toptexturescaley;
|
|
|
|
static fixed_t rw_bottomtexturescalex;
|
|
|
|
static fixed_t rw_bottomtexturescaley;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
FTexture *rw_pic;
|
|
|
|
|
2006-05-09 21:30:31 +00:00
|
|
|
static fixed_t *maskedtexturecol;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-04-13 02:01:40 +00:00
|
|
|
static void R_RenderDecal (side_t *wall, DBaseDecal *first, drawseg_t *clipper, int pass);
|
2006-02-24 04:48:15 +00:00
|
|
|
static void WallSpriteColumn (void (*drawfunc)(const BYTE *column, const FTexture::Span *spans));
|
2012-04-25 03:21:55 +00:00
|
|
|
void wallscan_np2(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrepeat, fixed_t top, fixed_t bot, bool mask);
|
|
|
|
static void wallscan_np2_ds(drawseg_t *ds, int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrepeat);
|
|
|
|
static void call_wallscan(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrepeat, bool mask);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
// CVAR r_fogboundary
|
|
|
|
//
|
|
|
|
// If true, makes fog look more "real" by shading the walls separating two
|
|
|
|
// sectors with different fog.
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
CVAR(Bool, r_fogboundary, true, 0)
|
|
|
|
|
|
|
|
inline bool IsFogBoundary (sector_t *front, sector_t *back)
|
|
|
|
{
|
2009-09-20 03:50:05 +00:00
|
|
|
return r_fogboundary && fixedcolormap == NULL && front->ColorMap->Fade &&
|
2006-02-24 04:48:15 +00:00
|
|
|
front->ColorMap->Fade != back->ColorMap->Fade &&
|
2008-08-16 20:19:35 +00:00
|
|
|
(front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
// CVAR r_drawmirrors
|
|
|
|
//
|
|
|
|
// Set to false to disable rendering of mirrors
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
CVAR(Bool, r_drawmirrors, true, 0)
|
|
|
|
|
|
|
|
//
|
|
|
|
// R_RenderMaskedSegRange
|
|
|
|
//
|
|
|
|
fixed_t *MaskedSWall;
|
2006-05-09 21:30:31 +00:00
|
|
|
fixed_t MaskedScaleY;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FTexture::Span *spans), FTexture *tex)
|
|
|
|
{
|
2006-05-09 21:30:31 +00:00
|
|
|
if (maskedtexturecol[dc_x] != FIXED_MAX)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// calculate lighting
|
2009-09-20 03:50:05 +00:00
|
|
|
if (fixedcolormap == NULL && fixedlightlev < 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
dc_colormap = basecolormap->Maps + (GETPALOOKUP (rw_light, wallshade) << COLORMAPSHIFT);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2007-04-29 12:07:27 +00:00
|
|
|
dc_iscale = MulScale18 (MaskedSWall[dc_x], MaskedScaleY);
|
2006-02-24 04:48:15 +00:00
|
|
|
sprtopscreen = centeryfrac - FixedMul (dc_texturemid, spryscale);
|
|
|
|
|
|
|
|
// killough 1/25/98: here's where Medusa came in, because
|
|
|
|
// it implicitly assumed that the column was all one patch.
|
|
|
|
// Originally, Doom did not construct complete columns for
|
|
|
|
// multipatched textures, so there were no header or trailer
|
|
|
|
// bytes in the column referred to below, which explains
|
|
|
|
// the Medusa effect. The fix is to construct true columns
|
|
|
|
// when forming multipatched textures (see r_data.c).
|
|
|
|
|
|
|
|
// draw the texture
|
|
|
|
const FTexture::Span *spans;
|
2006-05-09 21:30:31 +00:00
|
|
|
const BYTE *pixels = tex->GetColumn (maskedtexturecol[dc_x] >> FRACBITS, &spans);
|
2006-02-24 04:48:15 +00:00
|
|
|
blastfunc (pixels, spans);
|
2011-01-29 11:09:38 +00:00
|
|
|
// maskedtexturecol[dc_x] = FIXED_MAX; // kg3D - seems to be useless
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
rw_light += rw_lightstep;
|
|
|
|
spryscale += rw_scalestep;
|
|
|
|
}
|
|
|
|
|
2012-05-13 02:01:54 +00:00
|
|
|
// Clip a midtexture to the floor and ceiling of the sector in front of it.
|
|
|
|
void ClipMidtex(int x1, int x2)
|
|
|
|
{
|
|
|
|
short most[MAXWIDTH];
|
|
|
|
|
2014-08-01 01:23:04 +00:00
|
|
|
WallMost(most, curline->frontsector->ceilingplane, &WallC);
|
2012-05-13 02:01:54 +00:00
|
|
|
for (int i = x1; i <= x2; ++i)
|
|
|
|
{
|
|
|
|
if (wallupper[i] < most[i])
|
|
|
|
wallupper[i] = most[i];
|
|
|
|
}
|
2014-08-01 01:23:04 +00:00
|
|
|
WallMost(most, curline->frontsector->floorplane, &WallC);
|
2012-05-13 02:01:54 +00:00
|
|
|
for (int i = x1; i <= x2; ++i)
|
|
|
|
{
|
|
|
|
if (walllower[i] > most[i])
|
|
|
|
walllower[i] = most[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
void R_RenderFakeWallRange(drawseg_t *ds, int x1, int x2);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
|
|
|
|
{
|
|
|
|
FTexture *tex;
|
|
|
|
int i;
|
|
|
|
sector_t tempsec; // killough 4/13/98
|
2009-06-07 01:14:14 +00:00
|
|
|
fixed_t texheight, textop, texheightscale;
|
2012-04-28 02:32:33 +00:00
|
|
|
bool notrelevant = false;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
const sector_t *sec;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
sprflipvert = false;
|
|
|
|
|
|
|
|
curline = ds->curline;
|
|
|
|
|
|
|
|
// killough 4/11/98: draw translucent 2s normal textures
|
|
|
|
// [RH] modified because we don't use user-definable translucency maps
|
|
|
|
ESPSResult drawmode;
|
|
|
|
|
2008-05-30 06:56:50 +00:00
|
|
|
drawmode = R_SetPatchStyle (LegacyRenderStyles[curline->linedef->flags & ML_ADDTRANS ? STYLE_Add : STYLE_Translucent],
|
2008-05-02 10:55:48 +00:00
|
|
|
MIN(curline->linedef->Alpha, FRACUNIT), 0, 0);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
if ((drawmode == DontDraw && !ds->bFogBoundary && !ds->bFakeBoundary))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
NetUpdate ();
|
|
|
|
|
|
|
|
frontsector = curline->frontsector;
|
|
|
|
backsector = curline->backsector;
|
|
|
|
|
2011-11-04 01:12:53 +00:00
|
|
|
tex = TexMan(curline->sidedef->GetTexture(side_t::mid), true);
|
2011-05-13 03:29:48 +00:00
|
|
|
if (i_compatflags & COMPATF_MASKEDMIDTEX)
|
|
|
|
{
|
|
|
|
tex = tex->GetRawTexture();
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// killough 4/13/98: get correct lightlevel for 2s normal textures
|
2011-01-29 11:09:38 +00:00
|
|
|
sec = R_FakeFlat (frontsector, &tempsec, NULL, NULL, false);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
basecolormap = sec->ColorMap; // [RH] Set basecolormap
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
wallshade = ds->shade;
|
|
|
|
rw_lightstep = ds->lightstep;
|
|
|
|
rw_light = ds->light + (x1 - ds->x1) * rw_lightstep;
|
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
if (fixedlightlev < 0)
|
|
|
|
{
|
|
|
|
for (i = frontsector->e->XFloor.lightlist.Size() - 1; i >= 0; i--)
|
|
|
|
{
|
|
|
|
if (!(fake3D & FAKE3D_CLIPTOP))
|
|
|
|
{
|
|
|
|
sclipTop = sec->ceilingplane.ZatPoint(viewx, viewy);
|
|
|
|
}
|
|
|
|
if (sclipTop <= frontsector->e->XFloor.lightlist[i].plane.ZatPoint(viewx, viewy))
|
|
|
|
{
|
2012-04-01 02:31:57 +00:00
|
|
|
lightlist_t *lit = &frontsector->e->XFloor.lightlist[i];
|
|
|
|
basecolormap = lit->extra_colormap;
|
|
|
|
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource == NULL) + r_actualextralight);
|
2011-01-29 11:09:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
mfloorclip = openings + ds->sprbottomclip - ds->x1;
|
|
|
|
mceilingclip = openings + ds->sprtopclip - ds->x1;
|
|
|
|
|
|
|
|
// [RH] Draw fog partition
|
|
|
|
if (ds->bFogBoundary)
|
|
|
|
{
|
|
|
|
R_DrawFogBoundary (x1, x2, mceilingclip, mfloorclip);
|
|
|
|
if (ds->maskedtexturecol == -1)
|
|
|
|
{
|
|
|
|
goto clearfog;
|
|
|
|
}
|
|
|
|
}
|
2011-02-02 02:07:36 +00:00
|
|
|
if ((ds->bFakeBoundary && !(ds->bFakeBoundary & 4)) || drawmode == DontDraw)
|
|
|
|
{
|
|
|
|
goto clearfog;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
MaskedSWall = (fixed_t *)(openings + ds->swall) - ds->x1;
|
2009-06-07 01:14:14 +00:00
|
|
|
MaskedScaleY = ds->yrepeat;
|
2006-05-09 21:30:31 +00:00
|
|
|
maskedtexturecol = (fixed_t *)(openings + ds->maskedtexturecol) - ds->x1;
|
2006-02-24 04:48:15 +00:00
|
|
|
spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1);
|
|
|
|
rw_scalestep = ds->iscalestep;
|
|
|
|
|
|
|
|
// find positioning
|
2007-04-29 12:07:27 +00:00
|
|
|
texheight = tex->GetScaledHeight() << FRACBITS;
|
2009-06-07 01:14:14 +00:00
|
|
|
texheightscale = curline->sidedef->GetTextureYScale(side_t::mid);
|
|
|
|
if (texheightscale != FRACUNIT)
|
|
|
|
{
|
|
|
|
texheight = FixedDiv(texheight, texheightscale);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
|
|
|
{
|
2008-08-16 20:19:35 +00:00
|
|
|
dc_texturemid = MAX (frontsector->GetPlaneTexZ(sector_t::floor), backsector->GetPlaneTexZ(sector_t::floor)) + texheight;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-16 20:19:35 +00:00
|
|
|
dc_texturemid = MIN (frontsector->GetPlaneTexZ(sector_t::ceiling), backsector->GetPlaneTexZ(sector_t::ceiling));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-03-21 17:35:49 +00:00
|
|
|
|
2009-04-11 04:28:06 +00:00
|
|
|
{ // encapsulate the lifetime of rowoffset
|
2008-03-22 09:26:59 +00:00
|
|
|
fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid);
|
|
|
|
if (tex->bWorldPanning)
|
|
|
|
{
|
|
|
|
// rowoffset is added before the MulScale3 so that the masked texture will
|
|
|
|
// still be positioned in world units rather than texels.
|
|
|
|
dc_texturemid += rowoffset - viewz;
|
|
|
|
textop = dc_texturemid;
|
2009-06-07 01:14:14 +00:00
|
|
|
dc_texturemid = MulScale16 (dc_texturemid, MaskedScaleY);
|
2008-03-22 09:26:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// rowoffset is added outside the multiply so that it positions the texture
|
|
|
|
// by texels instead of world units.
|
2009-06-07 01:14:14 +00:00
|
|
|
textop = dc_texturemid - viewz + SafeDivScale16 (rowoffset, MaskedScaleY);
|
|
|
|
dc_texturemid = MulScale16 (dc_texturemid - viewz, MaskedScaleY) + rowoffset;
|
2008-03-22 09:26:59 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (fixedlightlev >= 0)
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
dc_colormap = basecolormap->Maps + fixedlightlev;
|
2009-09-20 03:50:05 +00:00
|
|
|
else if (fixedcolormap != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
dc_colormap = fixedcolormap;
|
|
|
|
|
2009-06-07 01:14:14 +00:00
|
|
|
if (!(curline->linedef->flags & ML_WRAP_MIDTEX) &&
|
|
|
|
!(curline->sidedef->Flags & WALLF_WRAP_MIDTEX))
|
2006-05-09 21:30:31 +00:00
|
|
|
{ // Texture does not wrap vertically.
|
|
|
|
|
|
|
|
// [RH] Don't bother drawing segs that are completely offscreen
|
|
|
|
if (MulScale12 (globaldclip, ds->sz1) < -textop &&
|
|
|
|
MulScale12 (globaldclip, ds->sz2) < -textop)
|
|
|
|
{ // Texture top is below the bottom of the screen
|
|
|
|
goto clearfog;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2006-05-09 21:30:31 +00:00
|
|
|
if (MulScale12 (globaluclip, ds->sz1) > texheight - textop &&
|
|
|
|
MulScale12 (globaluclip, ds->sz2) > texheight - textop)
|
|
|
|
{ // Texture bottom is above the top of the screen
|
2006-02-24 04:48:15 +00:00
|
|
|
goto clearfog;
|
2006-05-09 21:30:31 +00:00
|
|
|
}
|
|
|
|
|
2013-02-14 03:24:47 +00:00
|
|
|
if ((fake3D & FAKE3D_CLIPBOTTOM) && textop < sclipBottom - viewz)
|
2011-01-29 11:09:38 +00:00
|
|
|
{
|
2012-04-28 02:32:33 +00:00
|
|
|
notrelevant = true;
|
2011-01-29 11:09:38 +00:00
|
|
|
goto clearfog;
|
|
|
|
}
|
2013-02-14 03:24:47 +00:00
|
|
|
if ((fake3D & FAKE3D_CLIPTOP) && textop - texheight > sclipTop - viewz)
|
2011-01-29 11:09:38 +00:00
|
|
|
{
|
2012-04-28 02:32:33 +00:00
|
|
|
notrelevant = true;
|
2011-01-29 11:09:38 +00:00
|
|
|
goto clearfog;
|
|
|
|
}
|
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
WallC.sz1 = ds->sz1;
|
|
|
|
WallC.sz2 = ds->sz2;
|
|
|
|
WallC.sx1 = ds->sx1;
|
|
|
|
WallC.sx2 = ds->sx2;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
if (fake3D & FAKE3D_CLIPTOP)
|
|
|
|
{
|
2014-08-01 01:23:04 +00:00
|
|
|
OWallMost(wallupper, textop < sclipTop - viewz ? textop : sclipTop - viewz, &WallC);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-08-01 01:23:04 +00:00
|
|
|
OWallMost(wallupper, textop, &WallC);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
if (fake3D & FAKE3D_CLIPBOTTOM)
|
|
|
|
{
|
2014-08-01 01:23:04 +00:00
|
|
|
OWallMost(walllower, textop - texheight > sclipBottom - viewz ? textop - texheight : sclipBottom - viewz, &WallC);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-08-01 01:23:04 +00:00
|
|
|
OWallMost(walllower, textop - texheight, &WallC);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-09 21:30:31 +00:00
|
|
|
for (i = x1; i <= x2; i++)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-05-09 21:30:31 +00:00
|
|
|
if (wallupper[i] < mceilingclip[i])
|
|
|
|
wallupper[i] = mceilingclip[i];
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-05-09 21:30:31 +00:00
|
|
|
for (i = x1; i <= x2; i++)
|
|
|
|
{
|
|
|
|
if (walllower[i] > mfloorclip[i])
|
|
|
|
walllower[i] = mfloorclip[i];
|
|
|
|
}
|
2012-05-13 02:01:54 +00:00
|
|
|
|
|
|
|
if (CurrentSkybox)
|
|
|
|
{ // Midtex clipping doesn't work properly with skyboxes, since you're normally below the floor
|
|
|
|
// or above the ceiling, so the appropriate end won't be clipped automatically when adding
|
|
|
|
// this drawseg.
|
|
|
|
if ((curline->linedef->flags & ML_CLIP_MIDTEX) ||
|
|
|
|
(curline->sidedef->Flags & WALLF_CLIP_MIDTEX))
|
|
|
|
{
|
|
|
|
ClipMidtex(x1, x2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-09 21:30:31 +00:00
|
|
|
mfloorclip = walllower;
|
|
|
|
mceilingclip = wallupper;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-09 21:30:31 +00:00
|
|
|
// draw the columns one at a time
|
|
|
|
if (drawmode == DoDraw0)
|
|
|
|
{
|
|
|
|
for (dc_x = x1; dc_x <= x2; ++dc_x)
|
|
|
|
{
|
|
|
|
BlastMaskedColumn (R_DrawMaskedColumn, tex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-05-09 21:30:31 +00:00
|
|
|
// [RH] Draw up to four columns at once
|
|
|
|
int stop = (x2+1) & ~3;
|
|
|
|
|
|
|
|
if (x1 > x2)
|
|
|
|
goto clearfog;
|
|
|
|
|
|
|
|
dc_x = x1;
|
|
|
|
|
|
|
|
while ((dc_x < stop) && (dc_x & 3))
|
|
|
|
{
|
|
|
|
BlastMaskedColumn (R_DrawMaskedColumn, tex);
|
|
|
|
dc_x++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (dc_x < stop)
|
|
|
|
{
|
|
|
|
rt_initcols();
|
|
|
|
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex); dc_x++;
|
|
|
|
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex); dc_x++;
|
|
|
|
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex); dc_x++;
|
|
|
|
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex);
|
|
|
|
rt_draw4cols (dc_x - 3);
|
|
|
|
dc_x++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (dc_x <= x2)
|
|
|
|
{
|
|
|
|
BlastMaskedColumn (R_DrawMaskedColumn, tex);
|
|
|
|
dc_x++;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-05-09 21:30:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Texture does wrap vertically.
|
2014-08-07 22:12:04 +00:00
|
|
|
WallC.sz1 = ds->sz1;
|
|
|
|
WallC.sz2 = ds->sz2;
|
|
|
|
WallC.sx1 = ds->sx1;
|
|
|
|
WallC.sx2 = ds->sx2;
|
2011-01-29 11:09:38 +00:00
|
|
|
|
2012-05-13 02:01:54 +00:00
|
|
|
if (CurrentSkybox)
|
|
|
|
{ // Midtex clipping doesn't work properly with skyboxes, since you're normally below the floor
|
|
|
|
// or above the ceiling, so the appropriate end won't be clipped automatically when adding
|
|
|
|
// this drawseg.
|
|
|
|
if ((curline->linedef->flags & ML_CLIP_MIDTEX) ||
|
|
|
|
(curline->sidedef->Flags & WALLF_CLIP_MIDTEX))
|
|
|
|
{
|
|
|
|
ClipMidtex(x1, x2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
if (fake3D & FAKE3D_CLIPTOP)
|
|
|
|
{
|
2014-08-01 01:23:04 +00:00
|
|
|
OWallMost(wallupper, sclipTop - viewz, &WallC);
|
2011-01-29 11:09:38 +00:00
|
|
|
for (i = x1; i <= x2; i++)
|
|
|
|
{
|
|
|
|
if (wallupper[i] < mceilingclip[i])
|
|
|
|
wallupper[i] = mceilingclip[i];
|
|
|
|
}
|
|
|
|
mceilingclip = wallupper;
|
|
|
|
}
|
|
|
|
if (fake3D & FAKE3D_CLIPBOTTOM)
|
|
|
|
{
|
2014-08-01 01:23:04 +00:00
|
|
|
OWallMost(walllower, sclipBottom - viewz, &WallC);
|
2011-01-29 11:09:38 +00:00
|
|
|
for (i = x1; i <= x2; i++)
|
|
|
|
{
|
|
|
|
if (walllower[i] > mfloorclip[i])
|
|
|
|
walllower[i] = mfloorclip[i];
|
|
|
|
}
|
|
|
|
mfloorclip = walllower;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-09 21:30:31 +00:00
|
|
|
rw_offset = 0;
|
|
|
|
rw_pic = tex;
|
2012-04-25 03:21:55 +00:00
|
|
|
wallscan_np2_ds(ds, x1, x2, mceilingclip, mfloorclip, MaskedSWall, maskedtexturecol, ds->yrepeat);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
clearfog:
|
|
|
|
R_FinishSetPatchStyle ();
|
2011-01-29 11:09:38 +00:00
|
|
|
if (ds->bFakeBoundary & 3)
|
|
|
|
{
|
|
|
|
R_RenderFakeWallRange(ds, x1, x2);
|
|
|
|
}
|
2012-04-28 02:32:33 +00:00
|
|
|
if (!notrelevant)
|
2011-01-29 11:09:38 +00:00
|
|
|
{
|
2012-04-28 02:32:33 +00:00
|
|
|
if (fake3D & FAKE3D_REFRESHCLIP)
|
|
|
|
{
|
|
|
|
assert(ds->bkup >= 0);
|
|
|
|
memcpy(openings + ds->sprtopclip, openings + ds->bkup, (ds->x2-ds->x1+1) * 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
clearbufshort(openings + ds->sprtopclip - ds->x1 + x1, x2-x1+1, viewheight);
|
|
|
|
}
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// kg3D - render one fake wall
|
|
|
|
void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
fixed_t xscale, yscale;
|
|
|
|
|
|
|
|
fixed_t Alpha = Scale(rover->alpha, OPAQUE, 255);
|
|
|
|
ESPSResult drawmode;
|
|
|
|
drawmode = R_SetPatchStyle (LegacyRenderStyles[rover->flags & FF_ADDITIVETRANS ? STYLE_Add : STYLE_Translucent],
|
|
|
|
Alpha, 0, 0);
|
|
|
|
|
|
|
|
if(drawmode == DontDraw) {
|
|
|
|
R_FinishSetPatchStyle();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
rw_lightstep = ds->lightstep;
|
|
|
|
rw_light = ds->light + (x1 - ds->x1) * rw_lightstep;
|
|
|
|
|
|
|
|
mfloorclip = openings + ds->sprbottomclip - ds->x1;
|
|
|
|
mceilingclip = openings + ds->sprtopclip - ds->x1;
|
|
|
|
|
|
|
|
spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1);
|
|
|
|
rw_scalestep = ds->iscalestep;
|
|
|
|
MaskedSWall = (fixed_t *)(openings + ds->swall) - ds->x1;
|
|
|
|
|
|
|
|
// find positioning
|
2015-06-07 01:26:13 +00:00
|
|
|
side_t *scaledside;
|
|
|
|
side_t::ETexpart scaledpart;
|
|
|
|
if (rover->flags & FF_UPPERTEXTURE)
|
|
|
|
{
|
|
|
|
scaledside = curline->sidedef;
|
|
|
|
scaledpart = side_t::top;
|
|
|
|
}
|
|
|
|
else if (rover->flags & FF_LOWERTEXTURE)
|
|
|
|
{
|
|
|
|
scaledside = curline->sidedef;
|
|
|
|
scaledpart = side_t::bottom;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scaledside = rover->master->sidedef[0];
|
|
|
|
scaledpart = side_t::mid;
|
|
|
|
}
|
|
|
|
xscale = FixedMul(rw_pic->xScale, scaledside->GetTextureXScale(scaledpart));
|
|
|
|
yscale = FixedMul(rw_pic->yScale, scaledside->GetTextureYScale(scaledpart));
|
2011-01-29 11:09:38 +00:00
|
|
|
// encapsulate the lifetime of rowoffset
|
|
|
|
fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid);
|
|
|
|
dc_texturemid = rover->model->GetPlaneTexZ(sector_t::ceiling);
|
|
|
|
rw_offset = curline->sidedef->GetTextureXOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureXOffset(side_t::mid);
|
|
|
|
if (rowoffset < 0)
|
|
|
|
{
|
|
|
|
rowoffset += rw_pic->GetHeight() << FRACBITS;
|
|
|
|
}
|
|
|
|
if (rw_pic->bWorldPanning)
|
|
|
|
{
|
|
|
|
// rowoffset is added before the MulScale3 so that the masked texture will
|
|
|
|
// still be positioned in world units rather than texels.
|
|
|
|
|
|
|
|
dc_texturemid = MulScale16(dc_texturemid - viewz + rowoffset, yscale);
|
|
|
|
rw_offset = MulScale16 (rw_offset, xscale);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// rowoffset is added outside the multiply so that it positions the texture
|
|
|
|
// by texels instead of world units.
|
|
|
|
dc_texturemid = MulScale16(dc_texturemid - viewz, yscale) + rowoffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fixedlightlev >= 0)
|
|
|
|
dc_colormap = basecolormap->Maps + fixedlightlev;
|
|
|
|
else if (fixedcolormap != NULL)
|
|
|
|
dc_colormap = fixedcolormap;
|
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
WallC.sz1 = ds->sz1;
|
|
|
|
WallC.sz2 = ds->sz2;
|
|
|
|
WallC.sx1 = ds->sx1;
|
|
|
|
WallC.sx2 = ds->sx2;
|
|
|
|
WallC.tx1 = ds->cx;
|
|
|
|
WallC.ty1 = ds->cy;
|
|
|
|
WallC.tx2 = ds->cx + ds->cdx;
|
|
|
|
WallC.ty2 = ds->cy + ds->cdy;
|
2014-08-01 01:11:59 +00:00
|
|
|
WallT = ds->tmapvals;
|
2011-01-29 11:09:38 +00:00
|
|
|
|
2014-08-01 01:23:04 +00:00
|
|
|
OWallMost(wallupper, sclipTop - viewz, &WallC);
|
|
|
|
OWallMost(walllower, sclipBottom - viewz, &WallC);
|
2011-01-29 11:09:38 +00:00
|
|
|
|
|
|
|
for (i = x1; i <= x2; i++)
|
|
|
|
{
|
|
|
|
if (wallupper[i] < mceilingclip[i])
|
|
|
|
wallupper[i] = mceilingclip[i];
|
|
|
|
}
|
|
|
|
for (i = x1; i <= x2; i++)
|
|
|
|
{
|
|
|
|
if (walllower[i] > mfloorclip[i])
|
|
|
|
walllower[i] = mfloorclip[i];
|
|
|
|
}
|
|
|
|
|
2014-08-01 01:32:21 +00:00
|
|
|
PrepLWall (lwall, curline->sidedef->TexelLength*xscale, ds->sx1, ds->sx2);
|
2012-04-25 03:21:55 +00:00
|
|
|
wallscan_np2_ds(ds, x1, x2, wallupper, walllower, MaskedSWall, lwall, yscale);
|
2011-01-29 11:09:38 +00:00
|
|
|
R_FinishSetPatchStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
// kg3D - walls of fake floors
|
|
|
|
void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2)
|
|
|
|
{
|
|
|
|
FTexture *const DONT_DRAW = ((FTexture*)(intptr_t)-1);
|
|
|
|
int i,j;
|
2011-03-29 05:20:33 +00:00
|
|
|
F3DFloor *rover, *fover = NULL;
|
2011-01-29 11:09:38 +00:00
|
|
|
int passed, last;
|
|
|
|
fixed_t floorheight;
|
|
|
|
fixed_t ceilingheight;
|
|
|
|
|
|
|
|
sprflipvert = false;
|
|
|
|
curline = ds->curline;
|
|
|
|
|
|
|
|
frontsector = curline->frontsector;
|
|
|
|
backsector = curline->backsector;
|
|
|
|
|
|
|
|
if (backsector == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((ds->bFakeBoundary & 3) == 2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2011-01-29 11:09:38 +00:00
|
|
|
sector_t *sec = backsector;
|
|
|
|
backsector = frontsector;
|
|
|
|
frontsector = sec;
|
|
|
|
}
|
|
|
|
|
|
|
|
floorheight = backsector->CenterFloor();
|
|
|
|
ceilingheight = backsector->CenterCeiling();
|
|
|
|
|
|
|
|
// maybe fix clipheights
|
|
|
|
if (!(fake3D & FAKE3D_CLIPBOTTOM)) sclipBottom = floorheight;
|
|
|
|
if (!(fake3D & FAKE3D_CLIPTOP)) sclipTop = ceilingheight;
|
|
|
|
|
2011-05-13 03:29:48 +00:00
|
|
|
// maybe not visible
|
|
|
|
if (sclipBottom >= frontsector->CenterCeiling()) return;
|
|
|
|
if (sclipTop <= frontsector->CenterFloor()) return;
|
2011-04-29 03:50:33 +00:00
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
if (fake3D & FAKE3D_DOWN2UP)
|
|
|
|
{ // bottom to viewz
|
|
|
|
last = 0;
|
|
|
|
for (i = backsector->e->XFloor.ffloors.Size() - 1; i >= 0; i--)
|
|
|
|
{
|
|
|
|
rover = backsector->e->XFloor.ffloors[i];
|
|
|
|
if (!(rover->flags & FF_EXISTS)) continue;
|
|
|
|
|
|
|
|
// visible?
|
|
|
|
passed = 0;
|
|
|
|
if (!(rover->flags & FF_RENDERSIDES) ||
|
|
|
|
rover->top.plane->a || rover->top.plane->b ||
|
|
|
|
rover->bottom.plane->a || rover->bottom.plane->b ||
|
|
|
|
rover->top.plane->Zat0() <= sclipBottom ||
|
2011-04-29 03:50:33 +00:00
|
|
|
rover->bottom.plane->Zat0() >= ceilingheight ||
|
|
|
|
rover->top.plane->Zat0() <= floorheight)
|
2011-01-29 11:09:38 +00:00
|
|
|
{
|
|
|
|
if (!i)
|
|
|
|
{
|
|
|
|
passed = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rw_pic = NULL;
|
|
|
|
if (rover->bottom.plane->Zat0() >= sclipTop || passed)
|
|
|
|
{
|
|
|
|
if (last)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// maybe wall from inside rendering?
|
|
|
|
fover = NULL;
|
|
|
|
for (j = frontsector->e->XFloor.ffloors.Size() - 1; j >= 0; j--)
|
|
|
|
{
|
|
|
|
fover = frontsector->e->XFloor.ffloors[j];
|
|
|
|
if (fover->model == rover->model)
|
|
|
|
{ // never
|
|
|
|
fover = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!(fover->flags & FF_EXISTS)) continue;
|
|
|
|
if (!(fover->flags & FF_RENDERSIDES)) continue;
|
|
|
|
// no sloped walls, it's bugged
|
|
|
|
if (fover->top.plane->a || fover->top.plane->b || fover->bottom.plane->a || fover->bottom.plane->b) continue;
|
|
|
|
|
|
|
|
// visible?
|
|
|
|
if (fover->top.plane->Zat0() <= sclipBottom) continue; // no
|
|
|
|
if (fover->bottom.plane->Zat0() >= sclipTop)
|
|
|
|
{ // no, last possible
|
|
|
|
fover = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// it is, render inside?
|
|
|
|
if (!(fover->flags & (FF_BOTHPLANES|FF_INVERTPLANES)))
|
|
|
|
{ // no
|
|
|
|
fover = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// nothing
|
|
|
|
if (!fover || j == -1)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// correct texture
|
|
|
|
if (fover->flags & rover->flags & FF_SWIMMABLE)
|
|
|
|
{ // don't ever draw (but treat as something has been found)
|
|
|
|
rw_pic = DONT_DRAW;
|
|
|
|
}
|
|
|
|
else if(fover->flags & FF_UPPERTEXTURE)
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::top), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
else if(fover->flags & FF_LOWERTEXTURE)
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::bottom), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(fover->master->sidedef[0]->GetTexture(side_t::mid), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (frontsector->e->XFloor.ffloors.Size())
|
|
|
|
{
|
|
|
|
// maybe not visible?
|
|
|
|
fover = NULL;
|
|
|
|
for (j = frontsector->e->XFloor.ffloors.Size() - 1; j >= 0; j--)
|
|
|
|
{
|
|
|
|
fover = frontsector->e->XFloor.ffloors[j];
|
|
|
|
if (fover->model == rover->model) // never
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!(fover->flags & FF_EXISTS)) continue;
|
|
|
|
if (!(fover->flags & FF_RENDERSIDES)) continue;
|
|
|
|
// no sloped walls, it's bugged
|
|
|
|
if (fover->top.plane->a || fover->top.plane->b || fover->bottom.plane->a || fover->bottom.plane->b) continue;
|
|
|
|
|
|
|
|
// visible?
|
|
|
|
if (fover->top.plane->Zat0() <= sclipBottom) continue; // no
|
|
|
|
if (fover->bottom.plane->Zat0() >= sclipTop)
|
|
|
|
{ // visible, last possible
|
|
|
|
fover = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ((fover->flags & FF_SOLID) == (rover->flags & FF_SOLID) &&
|
|
|
|
!(!(fover->flags & FF_SOLID) && (fover->alpha == 255 || rover->alpha == 255))
|
|
|
|
)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (fover->flags & rover->flags & FF_SWIMMABLE)
|
|
|
|
{ // don't ever draw (but treat as something has been found)
|
|
|
|
rw_pic = DONT_DRAW;
|
|
|
|
}
|
|
|
|
fover = NULL; // visible
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (fover && j != -1)
|
|
|
|
{
|
|
|
|
fover = NULL;
|
|
|
|
last = 1;
|
|
|
|
continue; // not visible
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!rw_pic)
|
|
|
|
{
|
|
|
|
fover = NULL;
|
|
|
|
if (rover->flags & FF_UPPERTEXTURE)
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::top), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
else if(rover->flags & FF_LOWERTEXTURE)
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::bottom), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(rover->master->sidedef[0]->GetTexture(side_t::mid), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// correct colors now
|
|
|
|
basecolormap = frontsector->ColorMap;
|
|
|
|
wallshade = ds->shade;
|
|
|
|
if (fixedlightlev < 0)
|
|
|
|
{
|
|
|
|
if ((ds->bFakeBoundary & 3) == 2)
|
|
|
|
{
|
|
|
|
for (j = backsector->e->XFloor.lightlist.Size() - 1; j >= 0; j--)
|
|
|
|
{
|
|
|
|
if (sclipTop <= backsector->e->XFloor.lightlist[j].plane.Zat0())
|
|
|
|
{
|
2013-08-11 10:41:14 +00:00
|
|
|
lightlist_t *lit = &backsector->e->XFloor.lightlist[j];
|
2012-04-01 02:31:57 +00:00
|
|
|
basecolormap = lit->extra_colormap;
|
|
|
|
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource == NULL) + r_actualextralight);
|
2011-01-29 11:09:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (j = frontsector->e->XFloor.lightlist.Size() - 1; j >= 0; j--)
|
|
|
|
{
|
|
|
|
if (sclipTop <= frontsector->e->XFloor.lightlist[j].plane.Zat0())
|
|
|
|
{
|
2012-04-01 02:31:57 +00:00
|
|
|
lightlist_t *lit = &frontsector->e->XFloor.lightlist[j];
|
|
|
|
basecolormap = lit->extra_colormap;
|
|
|
|
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource == NULL) + r_actualextralight);
|
2011-01-29 11:09:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rw_pic != DONT_DRAW)
|
|
|
|
{
|
|
|
|
R_RenderFakeWall(ds, x1, x2, fover ? fover : rover);
|
|
|
|
}
|
|
|
|
else rw_pic = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // top to viewz
|
|
|
|
for (i = 0; i < (int)backsector->e->XFloor.ffloors.Size(); i++)
|
|
|
|
{
|
|
|
|
rover = backsector->e->XFloor.ffloors[i];
|
|
|
|
if (!(rover->flags & FF_EXISTS)) continue;
|
|
|
|
|
|
|
|
// visible?
|
|
|
|
passed = 0;
|
|
|
|
if (!(rover->flags & FF_RENDERSIDES) ||
|
|
|
|
rover->top.plane->a || rover->top.plane->b ||
|
|
|
|
rover->bottom.plane->a || rover->bottom.plane->b ||
|
|
|
|
rover->bottom.plane->Zat0() >= sclipTop ||
|
2011-04-29 03:50:33 +00:00
|
|
|
rover->top.plane->Zat0() <= floorheight ||
|
|
|
|
rover->bottom.plane->Zat0() >= ceilingheight)
|
2011-01-29 11:09:38 +00:00
|
|
|
{
|
2011-02-02 02:07:36 +00:00
|
|
|
if ((unsigned)i == backsector->e->XFloor.ffloors.Size() - 1)
|
2011-01-29 11:09:38 +00:00
|
|
|
{
|
|
|
|
passed = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rw_pic = NULL;
|
|
|
|
if (rover->top.plane->Zat0() <= sclipBottom || passed)
|
|
|
|
{ // maybe wall from inside rendering?
|
|
|
|
fover = NULL;
|
|
|
|
for (j = 0; j < (int)frontsector->e->XFloor.ffloors.Size(); j++)
|
|
|
|
{
|
|
|
|
fover = frontsector->e->XFloor.ffloors[j];
|
|
|
|
if (fover->model == rover->model)
|
|
|
|
{ // never
|
|
|
|
fover = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!(fover->flags & FF_EXISTS)) continue;
|
|
|
|
if (!(fover->flags & FF_RENDERSIDES)) continue;
|
|
|
|
// no sloped walls, it's bugged
|
|
|
|
if (fover->top.plane->a || fover->top.plane->b || fover->bottom.plane->a || fover->bottom.plane->b) continue;
|
|
|
|
|
|
|
|
// visible?
|
|
|
|
if (fover->bottom.plane->Zat0() >= sclipTop) continue; // no
|
|
|
|
if (fover->top.plane->Zat0() <= sclipBottom)
|
|
|
|
{ // no, last possible
|
|
|
|
fover = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// it is, render inside?
|
|
|
|
if (!(fover->flags & (FF_BOTHPLANES|FF_INVERTPLANES)))
|
|
|
|
{ // no
|
|
|
|
fover = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// nothing
|
2011-02-02 02:07:36 +00:00
|
|
|
if (!fover || (unsigned)j == frontsector->e->XFloor.ffloors.Size())
|
2011-01-29 11:09:38 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// correct texture
|
|
|
|
if (fover->flags & rover->flags & FF_SWIMMABLE)
|
|
|
|
{
|
|
|
|
rw_pic = DONT_DRAW; // don't ever draw (but treat as something has been found)
|
|
|
|
}
|
|
|
|
else if (fover->flags & FF_UPPERTEXTURE)
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::top), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
else if (fover->flags & FF_LOWERTEXTURE)
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::bottom), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(fover->master->sidedef[0]->GetTexture(side_t::mid), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (frontsector->e->XFloor.ffloors.Size())
|
|
|
|
{ // maybe not visible?
|
|
|
|
fover = NULL;
|
|
|
|
for (j = 0; j < (int)frontsector->e->XFloor.ffloors.Size(); j++)
|
|
|
|
{
|
|
|
|
fover = frontsector->e->XFloor.ffloors[j];
|
|
|
|
if (fover->model == rover->model)
|
|
|
|
{ // never
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!(fover->flags & FF_EXISTS)) continue;
|
|
|
|
if (!(fover->flags & FF_RENDERSIDES)) continue;
|
|
|
|
// no sloped walls, its bugged
|
|
|
|
if(fover->top.plane->a || fover->top.plane->b || fover->bottom.plane->a || fover->bottom.plane->b) continue;
|
|
|
|
|
|
|
|
// visible?
|
|
|
|
if (fover->bottom.plane->Zat0() >= sclipTop) continue; // no
|
|
|
|
if (fover->top.plane->Zat0() <= sclipBottom)
|
|
|
|
{ // visible, last possible
|
|
|
|
fover = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ((fover->flags & FF_SOLID) == (rover->flags & FF_SOLID) &&
|
|
|
|
!(!(rover->flags & FF_SOLID) && (fover->alpha == 255 || rover->alpha == 255))
|
|
|
|
)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (fover->flags & rover->flags & FF_SWIMMABLE)
|
|
|
|
{ // don't ever draw (but treat as something has been found)
|
|
|
|
rw_pic = DONT_DRAW;
|
|
|
|
}
|
|
|
|
fover = NULL; // visible
|
|
|
|
break;
|
|
|
|
}
|
2011-02-02 02:07:36 +00:00
|
|
|
if (fover && (unsigned)j != frontsector->e->XFloor.ffloors.Size())
|
2011-01-29 11:09:38 +00:00
|
|
|
{ // not visible
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rw_pic == NULL)
|
|
|
|
{
|
|
|
|
fover = NULL;
|
|
|
|
if (rover->flags & FF_UPPERTEXTURE)
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::top), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
else if (rover->flags & FF_LOWERTEXTURE)
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::bottom), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
rw_pic = TexMan(rover->master->sidedef[0]->GetTexture(side_t::mid), true);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// correct colors now
|
|
|
|
basecolormap = frontsector->ColorMap;
|
|
|
|
wallshade = ds->shade;
|
|
|
|
if (fixedlightlev < 0)
|
|
|
|
{
|
|
|
|
if ((ds->bFakeBoundary & 3) == 2)
|
|
|
|
{
|
|
|
|
for (j = backsector->e->XFloor.lightlist.Size() - 1; j >= 0; j--)
|
|
|
|
{
|
|
|
|
if (sclipTop <= backsector->e->XFloor.lightlist[j].plane.Zat0())
|
|
|
|
{
|
2012-04-01 02:31:57 +00:00
|
|
|
lightlist_t *lit = &backsector->e->XFloor.lightlist[j];
|
|
|
|
basecolormap = lit->extra_colormap;
|
|
|
|
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != NULL) + r_actualextralight);
|
2011-01-29 11:09:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (j = frontsector->e->XFloor.lightlist.Size() - 1; j >= 0; j--)
|
|
|
|
{
|
|
|
|
if(sclipTop <= frontsector->e->XFloor.lightlist[j].plane.Zat0())
|
|
|
|
{
|
2012-04-01 02:31:57 +00:00
|
|
|
lightlist_t *lit = &frontsector->e->XFloor.lightlist[j];
|
|
|
|
basecolormap = lit->extra_colormap;
|
|
|
|
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != NULL) + r_actualextralight);
|
2011-01-29 11:09:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rw_pic != DONT_DRAW)
|
|
|
|
{
|
|
|
|
R_RenderFakeWall(ds, x1, x2, fover ? fover : rover);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rw_pic = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// prevlineasm1 is like vlineasm1 but skips the loop if only drawing one pixel
|
2006-09-14 00:02:31 +00:00
|
|
|
inline fixed_t prevline1 (fixed_t vince, BYTE *colormap, int count, fixed_t vplce, const BYTE *bufplce, BYTE *dest)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
dc_iscale = vince;
|
|
|
|
dc_colormap = colormap;
|
|
|
|
dc_count = count;
|
|
|
|
dc_texturefrac = vplce;
|
|
|
|
dc_source = bufplce;
|
|
|
|
dc_dest = dest;
|
|
|
|
return doprevline1 ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal,
|
2009-06-07 01:14:14 +00:00
|
|
|
fixed_t yrepeat, const BYTE *(*getcol)(FTexture *tex, int x))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-05-09 21:30:31 +00:00
|
|
|
int x, shiftval;
|
|
|
|
int y1ve[4], y2ve[4], u4, d4, z;
|
2006-02-24 04:48:15 +00:00
|
|
|
char bad;
|
|
|
|
fixed_t light = rw_light - rw_lightstep;
|
2009-06-07 01:14:14 +00:00
|
|
|
SDWORD texturemid, xoffset;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
BYTE *basecolormapdata;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// This function also gets used to draw skies. Unlike BUILD, skies are
|
|
|
|
// drawn by visplane instead of by bunch, so these checks are invalid.
|
|
|
|
//if ((uwal[x1] > viewheight) && (uwal[x2] > viewheight)) return;
|
|
|
|
//if ((dwal[x1] < 0) && (dwal[x2] < 0)) return;
|
|
|
|
|
|
|
|
if (rw_pic->UseType == FTexture::TEX_Null)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//extern cycle_t WallScanCycles;
|
|
|
|
//clock (WallScanCycles);
|
|
|
|
|
|
|
|
rw_pic->GetHeight(); // Make sure texture size is loaded
|
|
|
|
shiftval = rw_pic->HeightBits;
|
|
|
|
setupvline (32-shiftval);
|
2009-06-07 01:14:14 +00:00
|
|
|
yrepeat >>= 2 + shiftval;
|
2006-02-24 04:48:15 +00:00
|
|
|
texturemid = dc_texturemid << (16 - shiftval);
|
|
|
|
xoffset = rw_offset;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
basecolormapdata = basecolormap->Maps;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
x = x1;
|
|
|
|
//while ((umost[x] > dmost[x]) && (x <= x2)) x++;
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0);
|
|
|
|
if (fixed)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
palookupoffse[0] = dc_colormap;
|
|
|
|
palookupoffse[1] = dc_colormap;
|
|
|
|
palookupoffse[2] = dc_colormap;
|
|
|
|
palookupoffse[3] = dc_colormap;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(; (x <= x2) && (x & 3); ++x)
|
|
|
|
{
|
|
|
|
light += rw_lightstep;
|
|
|
|
y1ve[0] = uwal[x];//max(uwal[x],umost[x]);
|
|
|
|
y2ve[0] = dwal[x];//min(dwal[x],dmost[x]);
|
|
|
|
if (y2ve[0] <= y1ve[0]) continue;
|
2006-07-11 04:48:10 +00:00
|
|
|
assert (y1ve[0] < viewheight);
|
|
|
|
assert (y2ve[0] <= viewheight);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (!fixed)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // calculate lighting
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
|
|
|
dc_dest = ylookup[y1ve[0]] + x + dc_destorg;
|
|
|
|
dc_iscale = swal[x] * yrepeat;
|
|
|
|
dc_count = y2ve[0] - y1ve[0];
|
|
|
|
dc_texturefrac = texturemid + FixedMul (dc_iscale, (y1ve[0]<<FRACBITS)-centeryfrac+FRACUNIT);
|
|
|
|
|
|
|
|
dovline1();
|
|
|
|
}
|
|
|
|
|
|
|
|
for(; x <= x2-3; x += 4)
|
|
|
|
{
|
|
|
|
bad = 0;
|
|
|
|
for (z = 3; z>= 0; --z)
|
|
|
|
{
|
|
|
|
y1ve[z] = uwal[x+z];//max(uwal[x+z],umost[x+z]);
|
|
|
|
y2ve[z] = dwal[x+z];//min(dwal[x+z],dmost[x+z])-1;
|
|
|
|
if (y2ve[z] <= y1ve[z]) { bad += 1<<z; continue; }
|
2006-07-11 04:48:10 +00:00
|
|
|
assert (y1ve[z] < viewheight);
|
|
|
|
assert (y2ve[z] <= viewheight);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bufplce[z] = getcol (rw_pic, (lwal[x+z] + xoffset) >> FRACBITS);
|
|
|
|
vince[z] = swal[x+z] * yrepeat;
|
|
|
|
vplce[z] = texturemid + FixedMul (vince[z], (y1ve[z]<<FRACBITS)-centeryfrac+FRACUNIT);
|
|
|
|
}
|
|
|
|
if (bad == 15)
|
|
|
|
{
|
|
|
|
light += rw_lightstep << 2;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (!fixed)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
light += rw_lightstep;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
palookupoffse[z] = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
u4 = MAX(MAX(y1ve[0],y1ve[1]),MAX(y1ve[2],y1ve[3]));
|
|
|
|
d4 = MIN(MIN(y2ve[0],y2ve[1]),MIN(y2ve[2],y2ve[3]));
|
|
|
|
|
|
|
|
if ((bad != 0) || (u4 >= d4))
|
|
|
|
{
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
if (!(bad & 1))
|
|
|
|
{
|
|
|
|
prevline1(vince[z],palookupoffse[z],y2ve[z]-y1ve[z],vplce[z],bufplce[z],ylookup[y1ve[z]]+x+z+dc_destorg);
|
|
|
|
}
|
|
|
|
bad >>= 1;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
if (u4 > y1ve[z])
|
|
|
|
{
|
|
|
|
vplce[z] = prevline1(vince[z],palookupoffse[z],u4-y1ve[z],vplce[z],bufplce[z],ylookup[y1ve[z]]+x+z+dc_destorg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (d4 > u4)
|
|
|
|
{
|
|
|
|
dc_count = d4-u4;
|
|
|
|
dc_dest = ylookup[u4]+x+dc_destorg;
|
|
|
|
dovline4();
|
|
|
|
}
|
|
|
|
|
|
|
|
BYTE *i = x+ylookup[d4]+dc_destorg;
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
if (y2ve[z] > d4)
|
|
|
|
{
|
|
|
|
prevline1(vince[z],palookupoffse[0],y2ve[z]-d4,vplce[z],bufplce[z],i+z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for(;x<=x2;x++)
|
|
|
|
{
|
|
|
|
light += rw_lightstep;
|
|
|
|
y1ve[0] = uwal[x];//max(uwal[x],umost[x]);
|
|
|
|
y2ve[0] = dwal[x];//min(dwal[x],dmost[x]);
|
|
|
|
if (y2ve[0] <= y1ve[0]) continue;
|
2006-07-11 04:48:10 +00:00
|
|
|
assert (y1ve[0] < viewheight);
|
|
|
|
assert (y2ve[0] <= viewheight);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (!fixed)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // calculate lighting
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
|
|
|
dc_dest = ylookup[y1ve[0]] + x + dc_destorg;
|
|
|
|
dc_iscale = swal[x] * yrepeat;
|
|
|
|
dc_count = y2ve[0] - y1ve[0];
|
|
|
|
dc_texturefrac = texturemid + FixedMul (dc_iscale, (y1ve[0]<<FRACBITS)-centeryfrac+FRACUNIT);
|
|
|
|
|
|
|
|
dovline1();
|
|
|
|
}
|
|
|
|
|
|
|
|
//unclock (WallScanCycles);
|
|
|
|
|
|
|
|
NetUpdate ();
|
|
|
|
}
|
|
|
|
|
2009-06-07 01:14:14 +00:00
|
|
|
void wallscan_striped (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrepeat)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
FDynamicColormap *startcolormap = basecolormap;
|
2006-02-24 04:48:15 +00:00
|
|
|
int startshade = wallshade;
|
|
|
|
bool fogginess = foggy;
|
|
|
|
|
|
|
|
short most1[MAXWIDTH], most2[MAXWIDTH], most3[MAXWIDTH];
|
|
|
|
short *up, *down;
|
|
|
|
|
|
|
|
up = uwal;
|
|
|
|
down = most1;
|
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
assert(WallC.sx1 <= x1);
|
|
|
|
assert(WallC.sx2 > x2);
|
2009-02-27 03:45:14 +00:00
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
// kg3D - fake floors instead of zdoom light list
|
|
|
|
for (unsigned int i = 0; i < frontsector->e->XFloor.lightlist.Size(); i++)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2014-08-01 01:23:04 +00:00
|
|
|
int j = WallMost (most3, frontsector->e->XFloor.lightlist[i].plane, &WallC);
|
2011-01-29 11:09:38 +00:00
|
|
|
if (j != 3)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2011-01-29 11:09:38 +00:00
|
|
|
for (int j = x1; j <= x2; ++j)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2011-01-29 11:09:38 +00:00
|
|
|
down[j] = clamp (most3[j], up[j], dwal[j]);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2011-01-29 11:09:38 +00:00
|
|
|
wallscan (x1, x2, up, down, swal, lwal, yrepeat);
|
|
|
|
up = down;
|
|
|
|
down = (down == most1) ? most2 : most1;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2012-04-01 02:31:57 +00:00
|
|
|
|
|
|
|
lightlist_t *lit = &frontsector->e->XFloor.lightlist[i];
|
|
|
|
basecolormap = lit->extra_colormap;
|
2011-01-29 11:09:38 +00:00
|
|
|
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(fogginess,
|
2012-04-01 02:31:57 +00:00
|
|
|
*lit->p_lightlevel, lit->lightsource != NULL) + r_actualextralight);
|
2011-01-29 11:09:38 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-06-07 01:14:14 +00:00
|
|
|
wallscan (x1, x2, up, dwal, swal, lwal, yrepeat);
|
2006-02-24 04:48:15 +00:00
|
|
|
basecolormap = startcolormap;
|
|
|
|
wallshade = startshade;
|
|
|
|
}
|
|
|
|
|
2012-04-25 03:21:55 +00:00
|
|
|
static void call_wallscan(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrepeat, bool mask)
|
2012-04-23 02:38:09 +00:00
|
|
|
{
|
2012-04-25 03:21:55 +00:00
|
|
|
if (mask)
|
2012-04-23 02:38:09 +00:00
|
|
|
{
|
2012-04-25 03:21:55 +00:00
|
|
|
if (colfunc == basecolfunc)
|
|
|
|
{
|
|
|
|
maskwallscan(x1, x2, uwal, dwal, swal, lwal, yrepeat);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
transmaskwallscan(x1, x2, uwal, dwal, swal, lwal, yrepeat);
|
|
|
|
}
|
2012-04-23 02:38:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-25 03:21:55 +00:00
|
|
|
if (fixedcolormap != NULL || fixedlightlev >= 0 || !(frontsector->e && frontsector->e->XFloor.lightlist.Size()))
|
|
|
|
{
|
|
|
|
wallscan(x1, x2, uwal, dwal, swal, lwal, yrepeat);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wallscan_striped(x1, x2, uwal, dwal, swal, lwal, yrepeat);
|
|
|
|
}
|
2012-04-23 02:38:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
// wallscan_np2
|
|
|
|
//
|
|
|
|
// This is a wrapper around wallscan that helps it tile textures whose heights
|
|
|
|
// are not powers of 2. It divides the wall into texture-sized strips and calls
|
|
|
|
// wallscan for each of those. Since only one repetition of the texture fits
|
|
|
|
// in each strip, wallscan will not tile.
|
|
|
|
//
|
|
|
|
//=============================================================================
|
|
|
|
|
2012-04-25 03:21:55 +00:00
|
|
|
void wallscan_np2(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrepeat, fixed_t top, fixed_t bot, bool mask)
|
2012-04-23 02:38:09 +00:00
|
|
|
{
|
2012-12-04 03:14:02 +00:00
|
|
|
if (!r_np2)
|
|
|
|
{
|
|
|
|
call_wallscan(x1, x2, uwal, dwal, swal, lwal, yrepeat, mask);
|
|
|
|
}
|
|
|
|
else
|
2012-04-23 02:38:09 +00:00
|
|
|
{
|
|
|
|
short most1[MAXWIDTH], most2[MAXWIDTH], most3[MAXWIDTH];
|
2012-12-04 03:14:02 +00:00
|
|
|
short *up, *down;
|
2012-04-23 02:38:09 +00:00
|
|
|
fixed_t texheight = rw_pic->GetHeight() << FRACBITS;
|
|
|
|
fixed_t scaledtexheight = FixedDiv(texheight, yrepeat);
|
2012-12-04 03:14:02 +00:00
|
|
|
fixed_t partition;
|
|
|
|
|
|
|
|
if (yrepeat >= 0)
|
|
|
|
{ // normal orientation: draw strips from top to bottom
|
|
|
|
partition = top - (top - FixedDiv(dc_texturemid, yrepeat) - viewz) % scaledtexheight;
|
|
|
|
up = uwal;
|
|
|
|
down = most1;
|
|
|
|
dc_texturemid = FixedMul(partition - viewz, yrepeat) + texheight;
|
|
|
|
while (partition > bot)
|
|
|
|
{
|
2014-08-01 01:23:04 +00:00
|
|
|
int j = OWallMost(most3, partition - viewz, &WallC);
|
2012-12-04 03:14:02 +00:00
|
|
|
if (j != 3)
|
|
|
|
{
|
|
|
|
for (int j = x1; j <= x2; ++j)
|
|
|
|
{
|
|
|
|
down[j] = clamp(most3[j], up[j], dwal[j]);
|
|
|
|
}
|
|
|
|
call_wallscan(x1, x2, up, down, swal, lwal, yrepeat, mask);
|
|
|
|
up = down;
|
|
|
|
down = (down == most1) ? most2 : most1;
|
|
|
|
}
|
|
|
|
partition -= scaledtexheight;
|
|
|
|
dc_texturemid -= texheight;
|
|
|
|
}
|
|
|
|
call_wallscan(x1, x2, up, dwal, swal, lwal, yrepeat, mask);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // upside down: draw strips from bottom to top
|
|
|
|
partition = bot - (bot - FixedDiv(dc_texturemid, yrepeat) - viewz) % scaledtexheight;
|
|
|
|
up = most1;
|
|
|
|
down = dwal;
|
|
|
|
dc_texturemid = FixedMul(partition - viewz, yrepeat) + texheight;
|
|
|
|
while (partition < top)
|
2012-04-23 02:38:09 +00:00
|
|
|
{
|
2014-08-01 01:23:04 +00:00
|
|
|
int j = OWallMost(most3, partition - viewz, &WallC);
|
2012-12-04 03:14:02 +00:00
|
|
|
if (j != 12)
|
2012-04-23 02:38:09 +00:00
|
|
|
{
|
2012-12-04 03:14:02 +00:00
|
|
|
for (int j = x1; j <= x2; ++j)
|
|
|
|
{
|
|
|
|
up[j] = clamp(most3[j], uwal[j], down[j]);
|
|
|
|
}
|
|
|
|
call_wallscan(x1, x2, up, down, swal, lwal, yrepeat, mask);
|
|
|
|
down = up;
|
|
|
|
up = (up == most1) ? most2 : most1;
|
2012-04-23 02:38:09 +00:00
|
|
|
}
|
2012-12-04 03:14:02 +00:00
|
|
|
partition -= scaledtexheight;
|
|
|
|
dc_texturemid -= texheight;
|
|
|
|
}
|
|
|
|
call_wallscan(x1, x2, uwal, down, swal, lwal, yrepeat, mask);
|
|
|
|
}
|
2012-04-23 02:38:09 +00:00
|
|
|
}
|
2012-04-25 03:21:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void wallscan_np2_ds(drawseg_t *ds, int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrepeat)
|
|
|
|
{
|
|
|
|
if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits)
|
|
|
|
{
|
|
|
|
fixed_t frontcz1 = ds->curline->frontsector->ceilingplane.ZatPoint(ds->curline->v1->x, ds->curline->v1->y);
|
|
|
|
fixed_t frontfz1 = ds->curline->frontsector->floorplane.ZatPoint(ds->curline->v1->x, ds->curline->v1->y);
|
|
|
|
fixed_t frontcz2 = ds->curline->frontsector->ceilingplane.ZatPoint(ds->curline->v2->x, ds->curline->v2->y);
|
|
|
|
fixed_t frontfz2 = ds->curline->frontsector->floorplane.ZatPoint(ds->curline->v2->x, ds->curline->v2->y);
|
|
|
|
fixed_t top = MAX(frontcz1, frontcz2);
|
|
|
|
fixed_t bot = MIN(frontfz1, frontfz2);
|
|
|
|
if (fake3D & FAKE3D_CLIPTOP)
|
|
|
|
{
|
|
|
|
top = MIN(top, sclipTop);
|
|
|
|
}
|
|
|
|
if (fake3D & FAKE3D_CLIPBOTTOM)
|
|
|
|
{
|
|
|
|
bot = MAX(bot, sclipBottom);
|
|
|
|
}
|
|
|
|
wallscan_np2(x1, x2, uwal, dwal, swal, lwal, yrepeat, top, bot, true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
call_wallscan(x1, x2, uwal, dwal, swal, lwal, yrepeat, true);
|
|
|
|
}
|
2012-04-23 02:38:09 +00:00
|
|
|
}
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
inline fixed_t mvline1 (fixed_t vince, BYTE *colormap, int count, fixed_t vplce, const BYTE *bufplce, BYTE *dest)
|
2006-05-09 21:30:31 +00:00
|
|
|
{
|
|
|
|
dc_iscale = vince;
|
|
|
|
dc_colormap = colormap;
|
|
|
|
dc_count = count;
|
|
|
|
dc_texturefrac = vplce;
|
|
|
|
dc_source = bufplce;
|
|
|
|
dc_dest = dest;
|
|
|
|
return domvline1 ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal,
|
2009-06-07 01:14:14 +00:00
|
|
|
fixed_t yrepeat, const BYTE *(*getcol)(FTexture *tex, int x))
|
2006-05-09 21:30:31 +00:00
|
|
|
{
|
|
|
|
int x, shiftval;
|
|
|
|
BYTE *p;
|
|
|
|
int y1ve[4], y2ve[4], u4, d4, startx, dax, z;
|
|
|
|
char bad;
|
|
|
|
fixed_t light = rw_light - rw_lightstep;
|
2009-06-07 01:14:14 +00:00
|
|
|
SDWORD texturemid, xoffset;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
BYTE *basecolormapdata;
|
2006-05-09 21:30:31 +00:00
|
|
|
|
|
|
|
if (rw_pic->UseType == FTexture::TEX_Null)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!rw_pic->bMasked)
|
|
|
|
{ // Textures that aren't masked can use the faster wallscan.
|
2009-06-07 01:14:14 +00:00
|
|
|
wallscan (x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol);
|
2006-05-09 21:30:31 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//extern cycle_t WallScanCycles;
|
|
|
|
//clock (WallScanCycles);
|
|
|
|
|
|
|
|
rw_pic->GetHeight(); // Make sure texture size is loaded
|
|
|
|
shiftval = rw_pic->HeightBits;
|
|
|
|
setupmvline (32-shiftval);
|
2009-06-07 01:14:14 +00:00
|
|
|
yrepeat >>= 2 + shiftval;
|
2006-05-09 21:30:31 +00:00
|
|
|
texturemid = dc_texturemid << (16 - shiftval);
|
|
|
|
xoffset = rw_offset;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
basecolormapdata = basecolormap->Maps;
|
2006-05-09 21:30:31 +00:00
|
|
|
|
|
|
|
x = startx = x1;
|
|
|
|
p = x + dc_destorg;
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0);
|
|
|
|
if (fixed)
|
2006-05-09 21:30:31 +00:00
|
|
|
{
|
|
|
|
palookupoffse[0] = dc_colormap;
|
|
|
|
palookupoffse[1] = dc_colormap;
|
|
|
|
palookupoffse[2] = dc_colormap;
|
|
|
|
palookupoffse[3] = dc_colormap;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(; (x <= x2) && ((size_t)p & 3); ++x, ++p)
|
|
|
|
{
|
|
|
|
light += rw_lightstep;
|
|
|
|
y1ve[0] = uwal[x];//max(uwal[x],umost[x]);
|
|
|
|
y2ve[0] = dwal[x];//min(dwal[x],dmost[x]);
|
|
|
|
if (y2ve[0] <= y1ve[0]) continue;
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (!fixed)
|
2006-05-09 21:30:31 +00:00
|
|
|
{ // calculate lighting
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
|
2006-05-09 21:30:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
|
|
|
dc_dest = ylookup[y1ve[0]] + p;
|
|
|
|
dc_iscale = swal[x] * yrepeat;
|
|
|
|
dc_count = y2ve[0] - y1ve[0];
|
|
|
|
dc_texturefrac = texturemid + FixedMul (dc_iscale, (y1ve[0]<<FRACBITS)-centeryfrac+FRACUNIT);
|
|
|
|
|
|
|
|
domvline1();
|
|
|
|
}
|
|
|
|
|
|
|
|
for(; x <= x2-3; x += 4, p+= 4)
|
|
|
|
{
|
|
|
|
bad = 0;
|
|
|
|
for (z = 3, dax = x+3; z >= 0; --z, --dax)
|
|
|
|
{
|
|
|
|
y1ve[z] = uwal[dax];
|
|
|
|
y2ve[z] = dwal[dax];
|
|
|
|
if (y2ve[z] <= y1ve[z]) { bad += 1<<z; continue; }
|
|
|
|
|
|
|
|
bufplce[z] = getcol (rw_pic, (lwal[dax] + xoffset) >> FRACBITS);
|
|
|
|
vince[z] = swal[dax] * yrepeat;
|
|
|
|
vplce[z] = texturemid + FixedMul (vince[z], (y1ve[z]<<FRACBITS)-centeryfrac+FRACUNIT);
|
|
|
|
}
|
|
|
|
if (bad == 15)
|
|
|
|
{
|
|
|
|
light += rw_lightstep << 2;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (!fixed)
|
2006-05-09 21:30:31 +00:00
|
|
|
{
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
light += rw_lightstep;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
palookupoffse[z] = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
|
2006-05-09 21:30:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
u4 = MAX(MAX(y1ve[0],y1ve[1]),MAX(y1ve[2],y1ve[3]));
|
|
|
|
d4 = MIN(MIN(y2ve[0],y2ve[1]),MIN(y2ve[2],y2ve[3]));
|
|
|
|
|
|
|
|
if ((bad != 0) || (u4 >= d4))
|
|
|
|
{
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
if (!(bad & 1))
|
|
|
|
{
|
|
|
|
mvline1(vince[z],palookupoffse[z],y2ve[z]-y1ve[z],vplce[z],bufplce[z],ylookup[y1ve[z]]+p+z);
|
|
|
|
}
|
|
|
|
bad >>= 1;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
if (u4 > y1ve[z])
|
|
|
|
{
|
|
|
|
vplce[z] = mvline1(vince[z],palookupoffse[z],u4-y1ve[z],vplce[z],bufplce[z],ylookup[y1ve[z]]+p+z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (d4 > u4)
|
|
|
|
{
|
|
|
|
dc_count = d4-u4;
|
|
|
|
dc_dest = ylookup[u4]+p;
|
|
|
|
domvline4();
|
|
|
|
}
|
|
|
|
|
|
|
|
BYTE *i = p+ylookup[d4];
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
if (y2ve[z] > d4)
|
|
|
|
{
|
|
|
|
mvline1(vince[z],palookupoffse[0],y2ve[z]-d4,vplce[z],bufplce[z],i+z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for(; x <= x2; ++x, ++p)
|
|
|
|
{
|
|
|
|
light += rw_lightstep;
|
|
|
|
y1ve[0] = uwal[x];
|
|
|
|
y2ve[0] = dwal[x];
|
|
|
|
if (y2ve[0] <= y1ve[0]) continue;
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (!fixed)
|
2006-05-09 21:30:31 +00:00
|
|
|
{ // calculate lighting
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
|
2006-05-09 21:30:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
|
|
|
dc_dest = ylookup[y1ve[0]] + p;
|
|
|
|
dc_iscale = swal[x] * yrepeat;
|
|
|
|
dc_count = y2ve[0] - y1ve[0];
|
|
|
|
dc_texturefrac = texturemid + FixedMul (dc_iscale, (y1ve[0]<<FRACBITS)-centeryfrac+FRACUNIT);
|
|
|
|
|
|
|
|
domvline1();
|
|
|
|
}
|
|
|
|
|
|
|
|
//unclock(WallScanCycles);
|
|
|
|
|
|
|
|
NetUpdate ();
|
|
|
|
}
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
inline void preptmvline1 (fixed_t vince, BYTE *colormap, int count, fixed_t vplce, const BYTE *bufplce, BYTE *dest)
|
2006-05-09 21:30:31 +00:00
|
|
|
{
|
|
|
|
dc_iscale = vince;
|
|
|
|
dc_colormap = colormap;
|
|
|
|
dc_count = count;
|
|
|
|
dc_texturefrac = vplce;
|
|
|
|
dc_source = bufplce;
|
|
|
|
dc_dest = dest;
|
|
|
|
}
|
|
|
|
|
|
|
|
void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal,
|
2009-06-07 01:14:14 +00:00
|
|
|
fixed_t yrepeat, const BYTE *(*getcol)(FTexture *tex, int x))
|
2006-05-09 21:30:31 +00:00
|
|
|
{
|
|
|
|
fixed_t (*tmvline1)();
|
|
|
|
void (*tmvline4)();
|
|
|
|
int x, shiftval;
|
|
|
|
BYTE *p;
|
|
|
|
int y1ve[4], y2ve[4], u4, d4, startx, dax, z;
|
|
|
|
char bad;
|
|
|
|
fixed_t light = rw_light - rw_lightstep;
|
2009-06-07 01:14:14 +00:00
|
|
|
SDWORD texturemid, xoffset;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
BYTE *basecolormapdata;
|
2006-05-09 21:30:31 +00:00
|
|
|
|
|
|
|
if (rw_pic->UseType == FTexture::TEX_Null)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!R_GetTransMaskDrawers (&tmvline1, &tmvline4))
|
|
|
|
{
|
|
|
|
// The current translucency is unsupported, so draw with regular maskwallscan instead.
|
2009-06-07 01:14:14 +00:00
|
|
|
maskwallscan (x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol);
|
2006-05-09 21:30:31 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//extern cycle_t WallScanCycles;
|
|
|
|
//clock (WallScanCycles);
|
|
|
|
|
|
|
|
rw_pic->GetHeight(); // Make sure texture size is loaded
|
|
|
|
shiftval = rw_pic->HeightBits;
|
|
|
|
setuptmvline (32-shiftval);
|
2009-06-07 01:14:14 +00:00
|
|
|
yrepeat >>= 2 + shiftval;
|
2006-05-09 21:30:31 +00:00
|
|
|
texturemid = dc_texturemid << (16 - shiftval);
|
|
|
|
xoffset = rw_offset;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
basecolormapdata = basecolormap->Maps;
|
2006-05-09 21:30:31 +00:00
|
|
|
|
|
|
|
x = startx = x1;
|
|
|
|
p = x + dc_destorg;
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0);
|
|
|
|
if (fixed)
|
2006-05-09 21:30:31 +00:00
|
|
|
{
|
|
|
|
palookupoffse[0] = dc_colormap;
|
|
|
|
palookupoffse[1] = dc_colormap;
|
|
|
|
palookupoffse[2] = dc_colormap;
|
|
|
|
palookupoffse[3] = dc_colormap;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(; (x <= x2) && ((size_t)p & 3); ++x, ++p)
|
|
|
|
{
|
|
|
|
light += rw_lightstep;
|
|
|
|
y1ve[0] = uwal[x];//max(uwal[x],umost[x]);
|
|
|
|
y2ve[0] = dwal[x];//min(dwal[x],dmost[x]);
|
|
|
|
if (y2ve[0] <= y1ve[0]) continue;
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (!fixed)
|
2006-05-09 21:30:31 +00:00
|
|
|
{ // calculate lighting
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
|
2006-05-09 21:30:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
|
|
|
dc_dest = ylookup[y1ve[0]] + p;
|
|
|
|
dc_iscale = swal[x] * yrepeat;
|
|
|
|
dc_count = y2ve[0] - y1ve[0];
|
|
|
|
dc_texturefrac = texturemid + FixedMul (dc_iscale, (y1ve[0]<<FRACBITS)-centeryfrac+FRACUNIT);
|
|
|
|
|
|
|
|
tmvline1();
|
|
|
|
}
|
|
|
|
|
|
|
|
for(; x <= x2-3; x += 4, p+= 4)
|
|
|
|
{
|
|
|
|
bad = 0;
|
|
|
|
for (z = 3, dax = x+3; z >= 0; --z, --dax)
|
|
|
|
{
|
|
|
|
y1ve[z] = uwal[dax];
|
|
|
|
y2ve[z] = dwal[dax];
|
|
|
|
if (y2ve[z] <= y1ve[z]) { bad += 1<<z; continue; }
|
|
|
|
|
|
|
|
bufplce[z] = getcol (rw_pic, (lwal[dax] + xoffset) >> FRACBITS);
|
|
|
|
vince[z] = swal[dax] * yrepeat;
|
|
|
|
vplce[z] = texturemid + FixedMul (vince[z], (y1ve[z]<<FRACBITS)-centeryfrac+FRACUNIT);
|
|
|
|
}
|
|
|
|
if (bad == 15)
|
|
|
|
{
|
|
|
|
light += rw_lightstep << 2;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (!fixed)
|
2006-05-09 21:30:31 +00:00
|
|
|
{
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
light += rw_lightstep;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
palookupoffse[z] = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
|
2006-05-09 21:30:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
u4 = MAX(MAX(y1ve[0],y1ve[1]),MAX(y1ve[2],y1ve[3]));
|
|
|
|
d4 = MIN(MIN(y2ve[0],y2ve[1]),MIN(y2ve[2],y2ve[3]));
|
|
|
|
|
|
|
|
if ((bad != 0) || (u4 >= d4))
|
|
|
|
{
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
if (!(bad & 1))
|
|
|
|
{
|
|
|
|
preptmvline1(vince[z],palookupoffse[z],y2ve[z]-y1ve[z],vplce[z],bufplce[z],ylookup[y1ve[z]]+p+z);
|
|
|
|
tmvline1();
|
|
|
|
}
|
|
|
|
bad >>= 1;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
if (u4 > y1ve[z])
|
|
|
|
{
|
|
|
|
preptmvline1(vince[z],palookupoffse[z],u4-y1ve[z],vplce[z],bufplce[z],ylookup[y1ve[z]]+p+z);
|
|
|
|
vplce[z] = tmvline1();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (d4 > u4)
|
|
|
|
{
|
|
|
|
dc_count = d4-u4;
|
|
|
|
dc_dest = ylookup[u4]+p;
|
|
|
|
tmvline4();
|
|
|
|
}
|
|
|
|
|
|
|
|
BYTE *i = p+ylookup[d4];
|
|
|
|
for (z = 0; z < 4; ++z)
|
|
|
|
{
|
|
|
|
if (y2ve[z] > d4)
|
|
|
|
{
|
|
|
|
preptmvline1(vince[z],palookupoffse[0],y2ve[z]-d4,vplce[z],bufplce[z],i+z);
|
|
|
|
tmvline1();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for(; x <= x2; ++x, ++p)
|
|
|
|
{
|
|
|
|
light += rw_lightstep;
|
|
|
|
y1ve[0] = uwal[x];
|
|
|
|
y2ve[0] = dwal[x];
|
|
|
|
if (y2ve[0] <= y1ve[0]) continue;
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (!fixed)
|
2006-05-09 21:30:31 +00:00
|
|
|
{ // calculate lighting
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
|
2006-05-09 21:30:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
|
|
|
dc_dest = ylookup[y1ve[0]] + p;
|
|
|
|
dc_iscale = swal[x] * yrepeat;
|
|
|
|
dc_count = y2ve[0] - y1ve[0];
|
|
|
|
dc_texturefrac = texturemid + FixedMul (dc_iscale, (y1ve[0]<<FRACBITS)-centeryfrac+FRACUNIT);
|
|
|
|
|
|
|
|
tmvline1();
|
|
|
|
}
|
|
|
|
|
|
|
|
//unclock(WallScanCycles);
|
|
|
|
|
|
|
|
NetUpdate ();
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// R_RenderSegLoop
|
|
|
|
// Draws zero, one, or two textures for walls.
|
|
|
|
// Can draw or mark the starting pixel of floor and ceiling textures.
|
|
|
|
// CALLED: CORE LOOPING ROUTINE.
|
|
|
|
//
|
|
|
|
// [RH] Rewrote this to use Build's wallscan, so it's quite far
|
|
|
|
// removed from the original Doom routine.
|
|
|
|
//
|
|
|
|
|
|
|
|
void R_RenderSegLoop ()
|
|
|
|
{
|
|
|
|
int x1 = rw_x;
|
|
|
|
int x2 = rw_stopx;
|
|
|
|
int x;
|
2009-06-07 01:14:14 +00:00
|
|
|
fixed_t xscale, yscale;
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t xoffset = rw_offset;
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (fixedlightlev >= 0)
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
dc_colormap = basecolormap->Maps + fixedlightlev;
|
2009-09-20 03:50:05 +00:00
|
|
|
else if (fixedcolormap != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
dc_colormap = fixedcolormap;
|
|
|
|
|
|
|
|
// clip wall to the floor and ceiling
|
|
|
|
for (x = x1; x < x2; ++x)
|
|
|
|
{
|
|
|
|
if (walltop[x] < ceilingclip[x])
|
|
|
|
{
|
|
|
|
walltop[x] = ceilingclip[x];
|
|
|
|
}
|
|
|
|
if (wallbottom[x] > floorclip[x])
|
|
|
|
{
|
|
|
|
wallbottom[x] = floorclip[x];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// mark ceiling areas
|
|
|
|
if (markceiling)
|
|
|
|
{
|
|
|
|
for (x = x1; x < x2; ++x)
|
|
|
|
{
|
2011-01-29 11:09:38 +00:00
|
|
|
short top = (fakeFloor && fake3D & 2) ? fakeFloor->ceilingclip[x] : ceilingclip[x];
|
2006-02-24 04:48:15 +00:00
|
|
|
short bottom = MIN (walltop[x], floorclip[x]);
|
|
|
|
if (top < bottom)
|
|
|
|
{
|
|
|
|
ceilingplane->top[x] = top;
|
|
|
|
ceilingplane->bottom[x] = bottom;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// mark floor areas
|
|
|
|
if (markfloor)
|
|
|
|
{
|
|
|
|
for (x = x1; x < x2; ++x)
|
|
|
|
{
|
|
|
|
short top = MAX (wallbottom[x], ceilingclip[x]);
|
2011-01-29 11:09:38 +00:00
|
|
|
short bottom = (fakeFloor && fake3D & 1) ? fakeFloor->floorclip[x] : floorclip[x];
|
2006-02-24 04:48:15 +00:00
|
|
|
if (top < bottom)
|
|
|
|
{
|
2006-07-12 03:35:55 +00:00
|
|
|
assert (bottom <= viewheight);
|
2006-02-24 04:48:15 +00:00
|
|
|
floorplane->top[x] = top;
|
|
|
|
floorplane->bottom[x] = bottom;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
// kg3D - fake planes clipping
|
|
|
|
if (fake3D & FAKE3D_REFRESHCLIP)
|
|
|
|
{
|
2011-04-13 02:34:48 +00:00
|
|
|
if (fake3D & FAKE3D_CLIPBOTFRONT)
|
2011-01-29 11:09:38 +00:00
|
|
|
{
|
|
|
|
memcpy (fakeFloor->floorclip+x1, wallbottom+x1, (x2-x1)*sizeof(short));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (x = x1; x < x2; ++x)
|
|
|
|
{
|
|
|
|
walllower[x] = MIN (MAX (walllower[x], ceilingclip[x]), wallbottom[x]);
|
|
|
|
}
|
|
|
|
memcpy (fakeFloor->floorclip+x1, walllower+x1, (x2-x1)*sizeof(short));
|
|
|
|
}
|
2011-04-13 02:34:48 +00:00
|
|
|
if (fake3D & FAKE3D_CLIPTOPFRONT)
|
2011-01-29 11:09:38 +00:00
|
|
|
{
|
|
|
|
memcpy (fakeFloor->ceilingclip+x1, walltop+x1, (x2-x1)*sizeof(short));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (x = x1; x < x2; ++x)
|
|
|
|
{
|
|
|
|
wallupper[x] = MAX (MIN (wallupper[x], floorclip[x]), walltop[x]);
|
|
|
|
}
|
|
|
|
memcpy (fakeFloor->ceilingclip+x1, wallupper+x1, (x2-x1)*sizeof(short));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(fake3D & 7) return;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// draw the wall tiers
|
|
|
|
if (midtexture)
|
|
|
|
{ // one sided line
|
|
|
|
if (midtexture->UseType != FTexture::TEX_Null && viewactive)
|
|
|
|
{
|
|
|
|
dc_texturemid = rw_midtexturemid;
|
|
|
|
rw_pic = midtexture;
|
2009-06-07 01:14:14 +00:00
|
|
|
xscale = FixedMul(rw_pic->xScale, rw_midtexturescalex);
|
|
|
|
yscale = FixedMul(rw_pic->yScale, rw_midtexturescaley);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (xscale != lwallscale)
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
PrepLWall (lwall, curline->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2);
|
2006-02-24 04:48:15 +00:00
|
|
|
lwallscale = xscale;
|
|
|
|
}
|
|
|
|
if (midtexture->bWorldPanning)
|
|
|
|
{
|
2009-06-07 01:14:14 +00:00
|
|
|
rw_offset = MulScale16 (rw_offset_mid, xscale);
|
2008-03-21 17:35:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rw_offset = rw_offset_mid;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2012-12-04 03:24:25 +00:00
|
|
|
if (xscale < 0)
|
|
|
|
{
|
|
|
|
rw_offset = -rw_offset;
|
|
|
|
}
|
2012-04-23 02:38:09 +00:00
|
|
|
if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2012-04-25 03:21:55 +00:00
|
|
|
wallscan_np2(x1, x2-1, walltop, wallbottom, swall, lwall, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_frontfz1, rw_frontfz2), false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-25 03:21:55 +00:00
|
|
|
call_wallscan(x1, x2-1, walltop, wallbottom, swall, lwall, yscale, false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
clearbufshort (ceilingclip+x1, x2-x1, viewheight);
|
|
|
|
clearbufshort (floorclip+x1, x2-x1, 0xffff);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // two sided line
|
|
|
|
if (toptexture != NULL && toptexture->UseType != FTexture::TEX_Null)
|
|
|
|
{ // top wall
|
|
|
|
for (x = x1; x < x2; ++x)
|
|
|
|
{
|
|
|
|
wallupper[x] = MAX (MIN (wallupper[x], floorclip[x]), walltop[x]);
|
|
|
|
}
|
|
|
|
if (viewactive)
|
|
|
|
{
|
|
|
|
dc_texturemid = rw_toptexturemid;
|
|
|
|
rw_pic = toptexture;
|
2009-06-07 01:14:14 +00:00
|
|
|
xscale = FixedMul(rw_pic->xScale, rw_toptexturescalex);
|
|
|
|
yscale = FixedMul(rw_pic->yScale, rw_toptexturescaley);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (xscale != lwallscale)
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
PrepLWall (lwall, curline->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2);
|
2006-02-24 04:48:15 +00:00
|
|
|
lwallscale = xscale;
|
|
|
|
}
|
|
|
|
if (toptexture->bWorldPanning)
|
|
|
|
{
|
2009-06-07 01:14:14 +00:00
|
|
|
rw_offset = MulScale16 (rw_offset_top, xscale);
|
2008-03-21 17:35:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rw_offset = rw_offset_top;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2012-12-04 03:24:25 +00:00
|
|
|
if (xscale < 0)
|
|
|
|
{
|
|
|
|
rw_offset = -rw_offset;
|
|
|
|
}
|
2012-04-23 02:38:09 +00:00
|
|
|
if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2012-04-25 03:21:55 +00:00
|
|
|
wallscan_np2(x1, x2-1, walltop, wallupper, swall, lwall, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_backcz1, rw_backcz2), false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-25 03:21:55 +00:00
|
|
|
call_wallscan(x1, x2-1, walltop, wallupper, swall, lwall, yscale, false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
memcpy (ceilingclip+x1, wallupper+x1, (x2-x1)*sizeof(short));
|
|
|
|
}
|
|
|
|
else if (markceiling)
|
|
|
|
{ // no top wall
|
|
|
|
memcpy (ceilingclip+x1, walltop+x1, (x2-x1)*sizeof(short));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (bottomtexture != NULL && bottomtexture->UseType != FTexture::TEX_Null)
|
|
|
|
{ // bottom wall
|
|
|
|
for (x = x1; x < x2; ++x)
|
|
|
|
{
|
|
|
|
walllower[x] = MIN (MAX (walllower[x], ceilingclip[x]), wallbottom[x]);
|
|
|
|
}
|
|
|
|
if (viewactive)
|
|
|
|
{
|
|
|
|
dc_texturemid = rw_bottomtexturemid;
|
|
|
|
rw_pic = bottomtexture;
|
2009-06-07 01:14:14 +00:00
|
|
|
xscale = FixedMul(rw_pic->xScale, rw_bottomtexturescalex);
|
|
|
|
yscale = FixedMul(rw_pic->yScale, rw_bottomtexturescaley);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (xscale != lwallscale)
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
PrepLWall (lwall, curline->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2);
|
2006-02-24 04:48:15 +00:00
|
|
|
lwallscale = xscale;
|
|
|
|
}
|
|
|
|
if (bottomtexture->bWorldPanning)
|
|
|
|
{
|
2009-06-07 01:14:14 +00:00
|
|
|
rw_offset = MulScale16 (rw_offset_bottom, xscale);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-21 17:35:49 +00:00
|
|
|
rw_offset = rw_offset_bottom;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2012-12-04 03:24:25 +00:00
|
|
|
if (xscale < 0)
|
|
|
|
{
|
|
|
|
rw_offset = -rw_offset;
|
|
|
|
}
|
2012-04-23 02:38:09 +00:00
|
|
|
if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2012-04-25 03:21:55 +00:00
|
|
|
wallscan_np2(x1, x2-1, walllower, wallbottom, swall, lwall, yscale, MAX(rw_backfz1, rw_backfz2), MIN(rw_frontfz1, rw_frontfz2), false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-25 03:21:55 +00:00
|
|
|
call_wallscan(x1, x2-1, walllower, wallbottom, swall, lwall, yscale, false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
memcpy (floorclip+x1, walllower+x1, (x2-x1)*sizeof(short));
|
|
|
|
}
|
|
|
|
else if (markfloor)
|
|
|
|
{ // no bottom wall
|
|
|
|
memcpy (floorclip+x1, wallbottom+x1, (x2-x1)*sizeof(short));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rw_offset = xoffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
void R_NewWall (bool needlights)
|
|
|
|
{
|
2009-06-07 01:14:14 +00:00
|
|
|
fixed_t rowoffset, yrepeat;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
rw_markmirror = false;
|
|
|
|
|
|
|
|
sidedef = curline->sidedef;
|
|
|
|
linedef = curline->linedef;
|
|
|
|
|
|
|
|
// mark the segment as visible for auto map
|
2006-06-18 15:49:00 +00:00
|
|
|
if (!r_dontmaplines) linedef->flags |= ML_MAPPED;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
midtexture = toptexture = bottomtexture = 0;
|
|
|
|
|
|
|
|
if (backsector == NULL)
|
|
|
|
{
|
|
|
|
// single sided line
|
|
|
|
// a single sided line is terminal, so it must mark ends
|
|
|
|
markfloor = markceiling = true;
|
|
|
|
// [RH] Render mirrors later, but mark them now.
|
|
|
|
if (linedef->special != Line_Mirror || !r_drawmirrors)
|
|
|
|
{
|
|
|
|
// [RH] Horizon lines do not need to be textured
|
|
|
|
if (linedef->special != Line_Horizon)
|
|
|
|
{
|
2011-11-04 01:12:53 +00:00
|
|
|
midtexture = TexMan(sidedef->GetTexture(side_t::mid), true);
|
2008-03-21 17:35:49 +00:00
|
|
|
rw_offset_mid = sidedef->GetTextureXOffset(side_t::mid);
|
|
|
|
rowoffset = sidedef->GetTextureYOffset(side_t::mid);
|
2009-06-07 01:14:14 +00:00
|
|
|
rw_midtexturescalex = sidedef->GetTextureXScale(side_t::mid);
|
|
|
|
rw_midtexturescaley = sidedef->GetTextureYScale(side_t::mid);
|
|
|
|
yrepeat = FixedMul(midtexture->yScale, rw_midtexturescaley);
|
2012-12-04 02:42:53 +00:00
|
|
|
if (yrepeat >= 0)
|
|
|
|
{ // normal orientation
|
|
|
|
if (linedef->flags & ML_DONTPEGBOTTOM)
|
|
|
|
{ // bottom of texture at bottom
|
|
|
|
rw_midtexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::floor) - viewz, yrepeat) + (midtexture->GetHeight() << FRACBITS);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // top of texture at top
|
|
|
|
rw_midtexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat);
|
|
|
|
if (rowoffset < 0 && midtexture != NULL)
|
|
|
|
{
|
|
|
|
rowoffset += midtexture->GetHeight() << FRACBITS;
|
|
|
|
}
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
2012-12-04 02:42:53 +00:00
|
|
|
{ // upside down
|
|
|
|
rowoffset = -rowoffset;
|
|
|
|
if (linedef->flags & ML_DONTPEGBOTTOM)
|
|
|
|
{ // top of texture at bottom
|
|
|
|
rw_midtexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::floor) - viewz, yrepeat);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // bottom of texture at top
|
|
|
|
rw_midtexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat) + (midtexture->GetHeight() << FRACBITS);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (midtexture->bWorldPanning)
|
|
|
|
{
|
2012-07-21 02:40:34 +00:00
|
|
|
rw_midtexturemid += MulScale16(rowoffset, yrepeat);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// rowoffset is added outside the multiply so that it positions the texture
|
|
|
|
// by texels instead of world units.
|
2012-06-22 04:07:53 +00:00
|
|
|
rw_midtexturemid += rowoffset;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rw_markmirror = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // two-sided line
|
|
|
|
// hack to allow height changes in outdoor areas
|
|
|
|
|
2008-08-16 20:19:35 +00:00
|
|
|
rw_frontlowertop = frontsector->GetPlaneTexZ(sector_t::ceiling);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-16 20:19:35 +00:00
|
|
|
if (frontsector->GetTexture(sector_t::ceiling) == skyflatnum &&
|
|
|
|
backsector->GetTexture(sector_t::ceiling) == skyflatnum)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (rw_havehigh)
|
|
|
|
{ // front ceiling is above back ceiling
|
2014-08-07 22:12:04 +00:00
|
|
|
memcpy (&walltop[WallC.sx1], &wallupper[WallC.sx1], (WallC.sx2 - WallC.sx1)*sizeof(walltop[0]));
|
2006-02-24 04:48:15 +00:00
|
|
|
rw_havehigh = false;
|
|
|
|
}
|
2006-05-19 06:22:36 +00:00
|
|
|
else if (rw_havelow && frontsector->ceilingplane != backsector->ceilingplane)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // back ceiling is above front ceiling
|
2006-05-19 06:22:36 +00:00
|
|
|
// The check for rw_havelow is not Doom-compliant, but it avoids HoM that
|
|
|
|
// would otherwise occur because there is space made available for this
|
|
|
|
// wall but nothing to draw for it.
|
2006-02-24 04:48:15 +00:00
|
|
|
// Recalculate walltop so that the wall is clipped by the back sector's
|
|
|
|
// ceiling instead of the front sector's ceiling.
|
2014-08-01 01:23:04 +00:00
|
|
|
WallMost (walltop, backsector->ceilingplane, &WallC);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-05-19 06:22:36 +00:00
|
|
|
// Putting sky ceilings on the front and back of a line alters the way unpegged
|
2006-02-24 04:48:15 +00:00
|
|
|
// positioning works.
|
2008-08-16 20:19:35 +00:00
|
|
|
rw_frontlowertop = backsector->GetPlaneTexZ(sector_t::ceiling);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2) ||
|
|
|
|
(rw_backfz1 >= rw_frontcz1 && rw_backfz2 >= rw_frontcz2))
|
|
|
|
{
|
|
|
|
// closed door
|
|
|
|
markceiling = markfloor = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
markfloor = rw_mustmarkfloor
|
|
|
|
|| backsector->floorplane != frontsector->floorplane
|
|
|
|
|| backsector->lightlevel != frontsector->lightlevel
|
2008-08-16 20:19:35 +00:00
|
|
|
|| backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// killough 3/7/98: Add checks for (x,y) offsets
|
2008-06-14 15:26:16 +00:00
|
|
|
|| backsector->GetXOffset(sector_t::floor) != frontsector->GetXOffset(sector_t::floor)
|
|
|
|
|| backsector->GetYOffset(sector_t::floor) != frontsector->GetYOffset(sector_t::floor)
|
2010-11-07 17:05:21 +00:00
|
|
|
|| backsector->GetAlpha(sector_t::floor) != frontsector->GetAlpha(sector_t::floor)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// killough 4/15/98: prevent 2s normals
|
|
|
|
// from bleeding through deep water
|
|
|
|
|| frontsector->heightsec
|
|
|
|
|
2008-08-16 20:19:35 +00:00
|
|
|
|| backsector->GetPlaneLight(sector_t::floor) != frontsector->GetPlaneLight(sector_t::floor)
|
|
|
|
|| backsector->GetFlags(sector_t::floor) != frontsector->GetFlags(sector_t::floor)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// [RH] Add checks for colormaps
|
|
|
|
|| backsector->ColorMap != frontsector->ColorMap
|
|
|
|
|
2008-06-14 15:26:16 +00:00
|
|
|
|| backsector->GetXScale(sector_t::floor) != frontsector->GetXScale(sector_t::floor)
|
|
|
|
|| backsector->GetYScale(sector_t::floor) != frontsector->GetYScale(sector_t::floor)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-06-14 15:26:16 +00:00
|
|
|
|| backsector->GetAngle(sector_t::floor) != frontsector->GetAngle(sector_t::floor)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
// kg3D - add fake lights
|
|
|
|
|| (frontsector->e && frontsector->e->XFloor.lightlist.Size())
|
|
|
|
|| (backsector->e && backsector->e->XFloor.lightlist.Size())
|
|
|
|
|
2009-06-07 01:14:14 +00:00
|
|
|
|| (sidedef->GetTexture(side_t::mid).isValid() &&
|
|
|
|
((linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX)) ||
|
|
|
|
(sidedef->Flags & (WALLF_CLIP_MIDTEX|WALLF_WRAP_MIDTEX))))
|
2006-02-24 04:48:15 +00:00
|
|
|
;
|
|
|
|
|
2008-08-16 20:19:35 +00:00
|
|
|
markceiling = (frontsector->GetTexture(sector_t::ceiling) != skyflatnum ||
|
|
|
|
backsector->GetTexture(sector_t::ceiling) != skyflatnum) &&
|
2006-02-24 04:48:15 +00:00
|
|
|
(rw_mustmarkceiling
|
|
|
|
|| backsector->ceilingplane != frontsector->ceilingplane
|
|
|
|
|| backsector->lightlevel != frontsector->lightlevel
|
2008-08-16 20:19:35 +00:00
|
|
|
|| backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// killough 3/7/98: Add checks for (x,y) offsets
|
2008-06-14 15:26:16 +00:00
|
|
|
|| backsector->GetXOffset(sector_t::ceiling) != frontsector->GetXOffset(sector_t::ceiling)
|
|
|
|
|| backsector->GetYOffset(sector_t::ceiling) != frontsector->GetYOffset(sector_t::ceiling)
|
2010-11-07 17:05:21 +00:00
|
|
|
|| backsector->GetAlpha(sector_t::ceiling) != frontsector->GetAlpha(sector_t::ceiling)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// killough 4/15/98: prevent 2s normals
|
|
|
|
// from bleeding through fake ceilings
|
2008-08-16 20:19:35 +00:00
|
|
|
|| (frontsector->heightsec && frontsector->GetTexture(sector_t::ceiling) != skyflatnum)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-16 20:19:35 +00:00
|
|
|
|| backsector->GetPlaneLight(sector_t::ceiling) != frontsector->GetPlaneLight(sector_t::ceiling)
|
|
|
|
|| backsector->GetFlags(sector_t::ceiling) != frontsector->GetFlags(sector_t::ceiling)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// [RH] Add check for colormaps
|
|
|
|
|| backsector->ColorMap != frontsector->ColorMap
|
|
|
|
|
2008-06-14 15:26:16 +00:00
|
|
|
|| backsector->GetXScale(sector_t::ceiling) != frontsector->GetXScale(sector_t::ceiling)
|
|
|
|
|| backsector->GetYScale(sector_t::ceiling) != frontsector->GetYScale(sector_t::ceiling)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-06-14 15:26:16 +00:00
|
|
|
|| backsector->GetAngle(sector_t::ceiling) != frontsector->GetAngle(sector_t::ceiling)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
// kg3D - add fake lights
|
|
|
|
|| (frontsector->e && frontsector->e->XFloor.lightlist.Size())
|
|
|
|
|| (backsector->e && backsector->e->XFloor.lightlist.Size())
|
|
|
|
|
2009-06-07 01:14:14 +00:00
|
|
|
|| (sidedef->GetTexture(side_t::mid).isValid() &&
|
|
|
|
((linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX)) ||
|
|
|
|
(sidedef->Flags & (WALLF_CLIP_MIDTEX|WALLF_WRAP_MIDTEX))))
|
2006-02-24 04:48:15 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rw_havehigh)
|
|
|
|
{ // top texture
|
2011-11-04 01:12:53 +00:00
|
|
|
toptexture = TexMan(sidedef->GetTexture(side_t::top), true);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-21 17:35:49 +00:00
|
|
|
rw_offset_top = sidedef->GetTextureXOffset(side_t::top);
|
|
|
|
rowoffset = sidedef->GetTextureYOffset(side_t::top);
|
2009-06-07 01:14:14 +00:00
|
|
|
rw_toptexturescalex = sidedef->GetTextureXScale(side_t::top);
|
|
|
|
rw_toptexturescaley = sidedef->GetTextureYScale(side_t::top);
|
|
|
|
yrepeat = FixedMul(toptexture->yScale, rw_toptexturescaley);
|
2012-12-04 02:42:53 +00:00
|
|
|
if (yrepeat >= 0)
|
|
|
|
{ // normal orientation
|
|
|
|
if (linedef->flags & ML_DONTPEGTOP)
|
|
|
|
{ // top of texture at top
|
|
|
|
rw_toptexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat);
|
|
|
|
if (rowoffset < 0 && toptexture != NULL)
|
|
|
|
{
|
|
|
|
rowoffset += toptexture->GetHeight() << FRACBITS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // bottom of texture at bottom
|
|
|
|
rw_toptexturemid = MulScale16(backsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat) + (toptexture->GetHeight() << FRACBITS);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2012-12-04 02:42:53 +00:00
|
|
|
{ // upside down
|
|
|
|
rowoffset = -rowoffset;
|
|
|
|
if (linedef->flags & ML_DONTPEGTOP)
|
|
|
|
{ // bottom of texture at top
|
|
|
|
rw_toptexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat) + (toptexture->GetHeight() << FRACBITS);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // top of texture at bottom
|
|
|
|
rw_toptexturemid = MulScale16(backsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
if (toptexture->bWorldPanning)
|
|
|
|
{
|
2009-06-07 01:14:14 +00:00
|
|
|
rw_toptexturemid += MulScale16(rowoffset, yrepeat);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rw_toptexturemid += rowoffset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rw_havelow)
|
|
|
|
{ // bottom texture
|
2011-11-04 01:12:53 +00:00
|
|
|
bottomtexture = TexMan(sidedef->GetTexture(side_t::bottom), true);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-21 17:35:49 +00:00
|
|
|
rw_offset_bottom = sidedef->GetTextureXOffset(side_t::bottom);
|
|
|
|
rowoffset = sidedef->GetTextureYOffset(side_t::bottom);
|
2009-06-07 01:14:14 +00:00
|
|
|
rw_bottomtexturescalex = sidedef->GetTextureXScale(side_t::bottom);
|
|
|
|
rw_bottomtexturescaley = sidedef->GetTextureYScale(side_t::bottom);
|
|
|
|
yrepeat = FixedMul(bottomtexture->yScale, rw_bottomtexturescaley);
|
2012-12-04 02:42:53 +00:00
|
|
|
if (yrepeat >= 0)
|
|
|
|
{ // normal orientation
|
|
|
|
if (linedef->flags & ML_DONTPEGBOTTOM)
|
|
|
|
{ // bottom of texture at bottom
|
|
|
|
rw_bottomtexturemid = MulScale16(rw_frontlowertop - viewz, yrepeat);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // top of texture at top
|
|
|
|
rw_bottomtexturemid = MulScale16(backsector->GetPlaneTexZ(sector_t::floor) - viewz, yrepeat);
|
|
|
|
if (rowoffset < 0 && bottomtexture != NULL)
|
|
|
|
{
|
|
|
|
rowoffset += bottomtexture->GetHeight() << FRACBITS;
|
|
|
|
}
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
2012-12-04 02:42:53 +00:00
|
|
|
{ // upside down
|
|
|
|
rowoffset = -rowoffset;
|
|
|
|
if (linedef->flags & ML_DONTPEGBOTTOM)
|
|
|
|
{ // top of texture at bottom
|
|
|
|
rw_bottomtexturemid = MulScale16(rw_frontlowertop - viewz, yrepeat);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // bottom of texture at top
|
|
|
|
rw_bottomtexturemid = MulScale16(backsector->GetPlaneTexZ(sector_t::floor) - viewz, yrepeat) + (bottomtexture->GetHeight() << FRACBITS);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bottomtexture->bWorldPanning)
|
|
|
|
{
|
2012-12-04 02:42:53 +00:00
|
|
|
rw_bottomtexturemid += MulScale16(rowoffset, yrepeat);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-12-04 02:42:53 +00:00
|
|
|
rw_bottomtexturemid += rowoffset;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if a floor / ceiling plane is on the wrong side of the view plane,
|
|
|
|
// it is definitely invisible and doesn't need to be marked.
|
|
|
|
|
|
|
|
// killough 3/7/98: add deep water check
|
2009-05-23 10:21:33 +00:00
|
|
|
if (frontsector->GetHeightSec() == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2013-04-23 03:51:51 +00:00
|
|
|
int planeside;
|
|
|
|
|
|
|
|
planeside = frontsector->floorplane.PointOnSide(viewx, viewy, viewz);
|
|
|
|
if (frontsector->floorplane.c < 0) // 3D floors have the floor backwards
|
|
|
|
planeside = -planeside;
|
|
|
|
if (planeside <= 0) // above view plane
|
2006-02-24 04:48:15 +00:00
|
|
|
markfloor = false;
|
2013-04-23 03:51:51 +00:00
|
|
|
|
2013-05-04 19:08:17 +00:00
|
|
|
if (frontsector->GetTexture(sector_t::ceiling) != skyflatnum)
|
|
|
|
{
|
|
|
|
planeside = frontsector->ceilingplane.PointOnSide(viewx, viewy, viewz);
|
|
|
|
if (frontsector->ceilingplane.c > 0) // 3D floors have the ceiling backwards
|
|
|
|
planeside = -planeside;
|
|
|
|
if (planeside <= 0) // below view plane
|
|
|
|
markceiling = false;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2011-11-04 01:12:53 +00:00
|
|
|
FTexture *midtex = TexMan(sidedef->GetTexture(side_t::mid), true);
|
2008-03-21 17:35:49 +00:00
|
|
|
|
|
|
|
segtextured = midtex != NULL || toptexture != NULL || bottomtexture != NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// calculate light table
|
2009-06-07 01:14:14 +00:00
|
|
|
if (needlights && (segtextured || (backsector && IsFogBoundary(frontsector, backsector))))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-06-07 01:14:14 +00:00
|
|
|
lwallscale =
|
|
|
|
midtex ? FixedMul(midtex->xScale, sidedef->GetTextureXScale(side_t::mid)) :
|
|
|
|
toptexture ? FixedMul(toptexture->xScale, sidedef->GetTextureXScale(side_t::top)) :
|
|
|
|
bottomtexture ? FixedMul(bottomtexture->xScale, sidedef->GetTextureXScale(side_t::bottom)) :
|
|
|
|
FRACUNIT;
|
2007-04-29 12:07:27 +00:00
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
PrepWall (swall, lwall, sidedef->TexelLength * lwallscale, WallC.sx1, WallC.sx2);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
if (fixedcolormap == NULL && fixedlightlev < 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, frontsector->lightlevel)
|
|
|
|
+ r_actualextralight);
|
|
|
|
GlobVis = r_WallVisibility;
|
2014-08-07 22:12:04 +00:00
|
|
|
rw_lightleft = SafeDivScale12 (GlobVis, WallC.sz1);
|
|
|
|
rw_lightstep = (SafeDivScale12 (GlobVis, WallC.sz2) - rw_lightleft) / (WallC.sx2 - WallC.sx1);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rw_lightleft = FRACUNIT;
|
|
|
|
rw_lightstep = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// R_CheckDrawSegs
|
|
|
|
//
|
|
|
|
|
|
|
|
void R_CheckDrawSegs ()
|
|
|
|
{
|
|
|
|
if (ds_p == &drawsegs[MaxDrawSegs])
|
|
|
|
{ // [RH] Grab some more drawsegs
|
|
|
|
size_t newdrawsegs = MaxDrawSegs ? MaxDrawSegs*2 : 32;
|
|
|
|
ptrdiff_t firstofs = firstdrawseg - drawsegs;
|
2006-05-04 03:49:46 +00:00
|
|
|
drawsegs = (drawseg_t *)M_Realloc (drawsegs, newdrawsegs * sizeof(drawseg_t));
|
2006-02-24 04:48:15 +00:00
|
|
|
firstdrawseg = drawsegs + firstofs;
|
|
|
|
ds_p = drawsegs + MaxDrawSegs;
|
|
|
|
MaxDrawSegs = newdrawsegs;
|
2008-05-14 03:39:30 +00:00
|
|
|
DPrintf ("MaxDrawSegs increased to %zu\n", MaxDrawSegs);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// R_CheckOpenings
|
|
|
|
//
|
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
ptrdiff_t R_NewOpening (ptrdiff_t len)
|
|
|
|
{
|
|
|
|
ptrdiff_t res = lastopening;
|
|
|
|
lastopening += len;
|
|
|
|
if ((size_t)lastopening > maxopenings)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
do
|
|
|
|
maxopenings = maxopenings ? maxopenings*2 : 16384;
|
2011-01-29 11:09:38 +00:00
|
|
|
while ((size_t)lastopening > maxopenings);
|
2006-05-04 03:49:46 +00:00
|
|
|
openings = (short *)M_Realloc (openings, maxopenings * sizeof(*openings));
|
2008-05-14 03:39:30 +00:00
|
|
|
DPrintf ("MaxOpenings increased to %zu\n", maxopenings);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2011-01-29 11:09:38 +00:00
|
|
|
return res;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// R_StoreWallRange
|
|
|
|
// A wall segment will be drawn between start and stop pixels (inclusive).
|
|
|
|
//
|
|
|
|
|
|
|
|
void R_StoreWallRange (int start, int stop)
|
|
|
|
{
|
2011-01-29 11:09:38 +00:00
|
|
|
int i;
|
2006-02-24 04:48:15 +00:00
|
|
|
bool maskedtexture = false;
|
|
|
|
|
|
|
|
#ifdef RANGECHECK
|
|
|
|
if (start >= viewwidth || start >= stop)
|
|
|
|
I_FatalError ("Bad R_StoreWallRange: %i to %i", start , stop);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// don't overflow and crash
|
|
|
|
R_CheckDrawSegs ();
|
|
|
|
|
|
|
|
if (!rw_prepped)
|
|
|
|
{
|
|
|
|
rw_prepped = true;
|
|
|
|
R_NewWall (true);
|
|
|
|
}
|
|
|
|
|
2008-03-21 17:35:49 +00:00
|
|
|
rw_offset = sidedef->GetTextureXOffset(side_t::mid);
|
2014-08-07 22:12:04 +00:00
|
|
|
rw_light = rw_lightleft + rw_lightstep * (start - WallC.sx1);
|
|
|
|
|
|
|
|
ds_p->sx1 = WallC.sx1;
|
|
|
|
ds_p->sx2 = WallC.sx2;
|
|
|
|
ds_p->sz1 = WallC.sz1;
|
|
|
|
ds_p->sz2 = WallC.sz2;
|
|
|
|
ds_p->cx = WallC.tx1;
|
|
|
|
ds_p->cy = WallC.ty1;
|
|
|
|
ds_p->cdx = WallC.tx2 - WallC.tx1;
|
|
|
|
ds_p->cdy = WallC.ty2 - WallC.ty1;
|
2014-08-01 01:11:59 +00:00
|
|
|
ds_p->tmapvals = WallT;
|
2014-08-07 22:12:04 +00:00
|
|
|
ds_p->siz1 = (DWORD)DivScale32 (1, WallC.sz1) >> 1;
|
|
|
|
ds_p->siz2 = (DWORD)DivScale32 (1, WallC.sz2) >> 1;
|
2006-02-24 04:48:15 +00:00
|
|
|
ds_p->x1 = rw_x = start;
|
|
|
|
ds_p->x2 = stop-1;
|
|
|
|
ds_p->curline = curline;
|
|
|
|
rw_stopx = stop;
|
|
|
|
ds_p->bFogBoundary = false;
|
2011-01-29 11:09:38 +00:00
|
|
|
ds_p->bFakeBoundary = false;
|
|
|
|
if(fake3D & 7) ds_p->fake = 1;
|
|
|
|
else ds_p->fake = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// killough 1/6/98, 2/1/98: remove limit on openings
|
2011-01-29 11:09:38 +00:00
|
|
|
ds_p->sprtopclip = ds_p->sprbottomclip = ds_p->maskedtexturecol = ds_p->bkup = ds_p->swall = -1;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (rw_markmirror)
|
|
|
|
{
|
2006-06-09 00:26:07 +00:00
|
|
|
size_t drawsegnum = ds_p - drawsegs;
|
|
|
|
WallMirrors.Push (drawsegnum);
|
2006-02-24 04:48:15 +00:00
|
|
|
ds_p->silhouette = SIL_BOTH;
|
|
|
|
}
|
|
|
|
else if (backsector == NULL)
|
|
|
|
{
|
|
|
|
ds_p->sprtopclip = R_NewOpening (stop - start);
|
|
|
|
ds_p->sprbottomclip = R_NewOpening (stop - start);
|
|
|
|
clearbufshort (openings + ds_p->sprtopclip, stop-start, viewheight);
|
|
|
|
memset (openings + ds_p->sprbottomclip, -1, (stop-start)*sizeof(short));
|
|
|
|
ds_p->silhouette = SIL_BOTH;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// two sided line
|
|
|
|
ds_p->silhouette = 0;
|
|
|
|
|
|
|
|
if (rw_frontfz1 > rw_backfz1 || rw_frontfz2 > rw_backfz2 ||
|
2013-04-17 01:32:40 +00:00
|
|
|
backsector->floorplane.PointOnSide(viewx, viewy, viewz) < 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
ds_p->silhouette = SIL_BOTTOM;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rw_frontcz1 < rw_backcz1 || rw_frontcz2 < rw_backcz2 ||
|
2013-04-17 01:32:40 +00:00
|
|
|
backsector->ceilingplane.PointOnSide(viewx, viewy, viewz) < 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
ds_p->silhouette |= SIL_TOP;
|
|
|
|
}
|
|
|
|
|
|
|
|
// killough 1/17/98: this test is required if the fix
|
|
|
|
// for the automap bug (r_bsp.c) is used, or else some
|
|
|
|
// sprites will be displayed behind closed doors. That
|
|
|
|
// fix prevents lines behind closed doors with dropoffs
|
|
|
|
// from being displayed on the automap.
|
|
|
|
//
|
|
|
|
// killough 4/7/98: make doorclosed external variable
|
|
|
|
|
|
|
|
{
|
|
|
|
extern int doorclosed; // killough 1/17/98, 2/8/98, 4/7/98
|
|
|
|
if (doorclosed || (rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2))
|
|
|
|
{
|
|
|
|
ds_p->sprbottomclip = R_NewOpening (stop - start);
|
|
|
|
memset (openings + ds_p->sprbottomclip, -1, (stop-start)*sizeof(short));
|
|
|
|
ds_p->silhouette |= SIL_BOTTOM;
|
|
|
|
}
|
|
|
|
if (doorclosed || (rw_backfz1 >= rw_frontcz1 && rw_backfz2 >= rw_frontcz2))
|
|
|
|
{ // killough 1/17/98, 2/8/98
|
|
|
|
ds_p->sprtopclip = R_NewOpening (stop - start);
|
|
|
|
clearbufshort (openings + ds_p->sprtopclip, stop - start, viewheight);
|
|
|
|
ds_p->silhouette |= SIL_TOP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-13 02:34:48 +00:00
|
|
|
if(!ds_p->fake && r_3dfloors && backsector->e && backsector->e->XFloor.ffloors.Size()) {
|
2011-01-29 11:09:38 +00:00
|
|
|
for(i = 0; i < (int)backsector->e->XFloor.ffloors.Size(); i++) {
|
|
|
|
F3DFloor *rover = backsector->e->XFloor.ffloors[i];
|
|
|
|
if(rover->flags & FF_RENDERSIDES && (!(rover->flags & FF_INVERTSIDES) || rover->flags & FF_ALLSIDES)) {
|
|
|
|
ds_p->bFakeBoundary |= 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-04-13 02:34:48 +00:00
|
|
|
if(!ds_p->fake && r_3dfloors && frontsector->e && frontsector->e->XFloor.ffloors.Size()) {
|
2011-01-29 11:09:38 +00:00
|
|
|
for(i = 0; i < (int)frontsector->e->XFloor.ffloors.Size(); i++) {
|
|
|
|
F3DFloor *rover = frontsector->e->XFloor.ffloors[i];
|
|
|
|
if(rover->flags & FF_RENDERSIDES && (rover->flags & FF_ALLSIDES || rover->flags & FF_INVERTSIDES)) {
|
|
|
|
ds_p->bFakeBoundary |= 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// kg3D - no for fakes
|
|
|
|
if(!ds_p->fake)
|
2006-02-24 04:48:15 +00:00
|
|
|
// allocate space for masked texture tables, if needed
|
|
|
|
// [RH] Don't just allocate the space; fill it in too.
|
2011-11-04 01:12:53 +00:00
|
|
|
if ((TexMan(sidedef->GetTexture(side_t::mid), true)->UseType != FTexture::TEX_Null || ds_p->bFakeBoundary || IsFogBoundary (frontsector, backsector)) &&
|
2008-06-15 18:36:26 +00:00
|
|
|
(rw_ceilstat != 12 || !sidedef->GetTexture(side_t::top).isValid()) &&
|
|
|
|
(rw_floorstat != 3 || !sidedef->GetTexture(side_t::bottom).isValid()) &&
|
2014-08-07 22:12:04 +00:00
|
|
|
(WallC.sz1 >= TOO_CLOSE_Z && WallC.sz2 >= TOO_CLOSE_Z))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
fixed_t *swal;
|
2006-05-09 21:30:31 +00:00
|
|
|
fixed_t *lwal;
|
2006-02-24 04:48:15 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
maskedtexture = true;
|
|
|
|
|
2011-04-13 02:34:48 +00:00
|
|
|
// kg3D - backup for mid and fake walls
|
|
|
|
ds_p->bkup = R_NewOpening(stop - start);
|
|
|
|
memcpy(openings + ds_p->bkup, &ceilingclip[start], sizeof(short)*(stop - start));
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
ds_p->bFogBoundary = IsFogBoundary (frontsector, backsector);
|
2011-01-29 11:09:38 +00:00
|
|
|
if (sidedef->GetTexture(side_t::mid).isValid() || ds_p->bFakeBoundary)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2011-01-29 11:09:38 +00:00
|
|
|
if(sidedef->GetTexture(side_t::mid).isValid())
|
|
|
|
ds_p->bFakeBoundary |= 4; // it is also mid texture
|
|
|
|
|
2006-05-09 21:30:31 +00:00
|
|
|
ds_p->maskedtexturecol = R_NewOpening ((stop - start) * 2);
|
2006-02-24 04:48:15 +00:00
|
|
|
ds_p->swall = R_NewOpening ((stop - start) * 2);
|
|
|
|
|
2006-05-09 21:30:31 +00:00
|
|
|
lwal = (fixed_t *)(openings + ds_p->maskedtexturecol);
|
2006-02-24 04:48:15 +00:00
|
|
|
swal = (fixed_t *)(openings + ds_p->swall);
|
2011-11-04 01:12:53 +00:00
|
|
|
FTexture *pic = TexMan(sidedef->GetTexture(side_t::mid), true);
|
2009-06-07 01:14:14 +00:00
|
|
|
fixed_t yrepeat = FixedMul(pic->yScale, sidedef->GetTextureYScale(side_t::mid));
|
|
|
|
fixed_t xoffset = sidedef->GetTextureXOffset(side_t::mid);
|
2009-04-11 04:28:06 +00:00
|
|
|
|
|
|
|
if (pic->bWorldPanning)
|
|
|
|
{
|
2009-06-07 01:14:14 +00:00
|
|
|
xoffset = MulScale16 (xoffset, lwallscale);
|
2009-04-11 04:28:06 +00:00
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
for (i = start; i < stop; i++)
|
|
|
|
{
|
2006-05-09 21:30:31 +00:00
|
|
|
*lwal++ = lwall[i] + xoffset;
|
|
|
|
*swal++ = swall[i];
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2009-06-07 01:14:14 +00:00
|
|
|
fixed_t istart = MulScale18 (*((fixed_t *)(openings + ds_p->swall)), yrepeat);
|
|
|
|
fixed_t iend = MulScale18 (*(swal - 1), yrepeat);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (istart < 3 && istart >= 0) istart = 3;
|
|
|
|
if (istart > -3 && istart < 0) istart = -3;
|
|
|
|
if (iend < 3 && iend >= 0) iend = 3;
|
|
|
|
if (iend > -3 && iend < 0) iend = -3;
|
|
|
|
istart = DivScale32 (1, istart);
|
|
|
|
iend = DivScale32 (1, iend);
|
2009-06-07 01:14:14 +00:00
|
|
|
ds_p->yrepeat = yrepeat;
|
2006-02-24 04:48:15 +00:00
|
|
|
ds_p->iscale = istart;
|
|
|
|
if (stop - start > 1)
|
|
|
|
{
|
|
|
|
ds_p->iscalestep = (iend - istart) / (stop - start - 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ds_p->iscalestep = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ds_p->light = rw_light;
|
|
|
|
ds_p->lightstep = rw_lightstep;
|
2012-11-03 02:50:33 +00:00
|
|
|
|
|
|
|
// Masked midtextures should get the light level from the sector they reference,
|
|
|
|
// not from the current subsector, which is what the current wallshade value
|
|
|
|
// comes from. We make an exeption for polyobjects, however, since their "home"
|
|
|
|
// sector should be whichever one they move into.
|
|
|
|
if (curline->sidedef->Flags & WALLF_POLYOBJ)
|
|
|
|
{
|
|
|
|
ds_p->shade = wallshade;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ds_p->shade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, curline->frontsector->lightlevel)
|
|
|
|
+ r_actualextralight);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (ds_p->bFogBoundary || ds_p->maskedtexturecol != -1)
|
|
|
|
{
|
2006-06-09 00:26:07 +00:00
|
|
|
size_t drawsegnum = ds_p - drawsegs;
|
|
|
|
InterestingDrawsegs.Push (drawsegnum);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// render it
|
|
|
|
if (markceiling)
|
|
|
|
{
|
|
|
|
if (ceilingplane)
|
|
|
|
{ // killough 4/11/98: add NULL ptr checks
|
|
|
|
ceilingplane = R_CheckPlane (ceilingplane, start, stop-1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
markceiling = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (markfloor)
|
|
|
|
{
|
|
|
|
if (floorplane)
|
|
|
|
{ // killough 4/11/98: add NULL ptr checks
|
|
|
|
floorplane = R_CheckPlane (floorplane, start, stop-1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
markfloor = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
R_RenderSegLoop ();
|
|
|
|
|
2011-01-29 11:09:38 +00:00
|
|
|
if(fake3D & 7) {
|
|
|
|
ds_p++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// save sprite clipping info
|
|
|
|
if ( ((ds_p->silhouette & SIL_TOP) || maskedtexture) && ds_p->sprtopclip == -1)
|
|
|
|
{
|
|
|
|
ds_p->sprtopclip = R_NewOpening (stop - start);
|
|
|
|
memcpy (openings + ds_p->sprtopclip, &ceilingclip[start], sizeof(short)*(stop-start));
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ((ds_p->silhouette & SIL_BOTTOM) || maskedtexture) && ds_p->sprbottomclip == -1)
|
|
|
|
{
|
|
|
|
ds_p->sprbottomclip = R_NewOpening (stop - start);
|
|
|
|
memcpy (openings + ds_p->sprbottomclip, &floorclip[start], sizeof(short)*(stop-start));
|
|
|
|
}
|
|
|
|
|
2008-06-15 18:36:26 +00:00
|
|
|
if (maskedtexture && curline->sidedef->GetTexture(side_t::mid).isValid())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
ds_p->silhouette |= SIL_TOP | SIL_BOTTOM;
|
|
|
|
}
|
|
|
|
|
|
|
|
// [RH] Draw any decals bound to the seg
|
2006-04-12 01:50:09 +00:00
|
|
|
for (DBaseDecal *decal = curline->sidedef->AttachedDecals; decal != NULL; decal = decal->WallNext)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-04-13 02:01:40 +00:00
|
|
|
R_RenderDecal (curline->sidedef, decal, ds_p, 0);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ds_p++;
|
|
|
|
}
|
|
|
|
|
2014-08-01 01:23:04 +00:00
|
|
|
int OWallMost (short *mostbuf, fixed_t z, const FWallCoords *wallc)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int bad, y, ix1, ix2, iy1, iy2;
|
|
|
|
fixed_t s1, s2, s3, s4;
|
|
|
|
|
|
|
|
z = -(z >> 4);
|
2014-08-07 22:12:04 +00:00
|
|
|
s1 = MulScale16 (globaluclip, wallc->sz1); s2 = MulScale16 (globaluclip, wallc->sz2);
|
|
|
|
s3 = MulScale16 (globaldclip, wallc->sz1); s4 = MulScale16 (globaldclip, wallc->sz2);
|
2006-02-24 04:48:15 +00:00
|
|
|
bad = (z<s1)+((z<s2)<<1)+((z>s3)<<2)+((z>s4)<<3);
|
|
|
|
|
2010-08-11 03:56:31 +00:00
|
|
|
#if 1
|
2006-02-24 04:48:15 +00:00
|
|
|
if ((bad&3) == 3)
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
memset (&mostbuf[wallc->sx1], 0, (wallc->sx2 - wallc->sx1)*sizeof(mostbuf[0]));
|
2006-02-24 04:48:15 +00:00
|
|
|
return bad;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((bad&12) == 12)
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
clearbufshort (&mostbuf[wallc->sx1], wallc->sx2 - wallc->sx1, viewheight);
|
2006-02-24 04:48:15 +00:00
|
|
|
return bad;
|
|
|
|
}
|
2010-08-11 03:56:31 +00:00
|
|
|
#endif
|
2014-08-07 22:12:04 +00:00
|
|
|
ix1 = wallc->sx1; iy1 = wallc->sz1;
|
|
|
|
ix2 = wallc->sx2; iy2 = wallc->sz2;
|
2010-08-11 03:56:31 +00:00
|
|
|
#if 1
|
2006-02-24 04:48:15 +00:00
|
|
|
if (bad & 3)
|
|
|
|
{
|
|
|
|
int t = DivScale30 (z-s1, s2-s1);
|
2014-08-07 22:12:04 +00:00
|
|
|
int inty = wallc->sz1 + MulScale30 (wallc->sz2 - wallc->sz1, t);
|
|
|
|
int xcross = wallc->sx1 + Scale (MulScale30 (wallc->sz2, t), wallc->sx2 - wallc->sx1, inty);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if ((bad & 3) == 2)
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
if (wallc->sx1 <= xcross) { iy2 = inty; ix2 = xcross; }
|
|
|
|
if (wallc->sx2 > xcross) memset (&mostbuf[xcross], 0, (wallc->sx2-xcross)*sizeof(mostbuf[0]));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
if (xcross <= wallc->sx2) { iy1 = inty; ix1 = xcross; }
|
|
|
|
if (xcross > wallc->sx1) memset (&mostbuf[wallc->sx1], 0, (xcross-wallc->sx1)*sizeof(mostbuf[0]));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bad & 12)
|
|
|
|
{
|
|
|
|
int t = DivScale30 (z-s3, s4-s3);
|
2014-08-07 22:12:04 +00:00
|
|
|
int inty = wallc->sz1 + MulScale30 (wallc->sz2 - wallc->sz1, t);
|
|
|
|
int xcross = wallc->sx1 + Scale (MulScale30 (wallc->sz2, t), wallc->sx2 - wallc->sx1, inty);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if ((bad & 12) == 8)
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
if (wallc->sx1 <= xcross) { iy2 = inty; ix2 = xcross; }
|
|
|
|
if (wallc->sx2 > xcross) clearbufshort (&mostbuf[xcross], wallc->sx2 - xcross, viewheight);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
if (xcross <= wallc->sx2) { iy1 = inty; ix1 = xcross; }
|
|
|
|
if (xcross > wallc->sx1) clearbufshort (&mostbuf[wallc->sx1], xcross - wallc->sx1, viewheight);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
y = Scale (z, InvZtoScale, iy1);
|
|
|
|
if (ix2 == ix1)
|
|
|
|
{
|
|
|
|
mostbuf[ix1] = (short)((y + centeryfrac) >> FRACBITS);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fixed_t yinc = (Scale (z, InvZtoScale, iy2) - y) / (ix2 - ix1);
|
|
|
|
qinterpolatedown16short (&mostbuf[ix1], ix2-ix1, y + centeryfrac, yinc);
|
|
|
|
}
|
2010-08-11 03:56:31 +00:00
|
|
|
#else
|
|
|
|
double max = viewheight;
|
|
|
|
double zz = z / 65536.0;
|
|
|
|
#if 0
|
2014-08-07 22:12:04 +00:00
|
|
|
double z1 = zz * InvZtoScale / wallc->sz1;
|
|
|
|
double z2 = zz * InvZtoScale / wallc->sz2 - z1;
|
|
|
|
z2 /= (wallc->sx2 - wallc->sx1);
|
2010-08-11 03:56:31 +00:00
|
|
|
z1 += centeryfrac / 65536.0;
|
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
for (int x = wallc->sx1; x < wallc->sx2; ++x)
|
2010-08-11 03:56:31 +00:00
|
|
|
{
|
|
|
|
mostbuf[x] = xs_RoundToInt(clamp(z1, 0.0, max));
|
|
|
|
z1 += z2;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
double top, bot, i;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
i = wallc->sx1 - centerx;
|
2014-08-01 01:11:59 +00:00
|
|
|
top = WallT.UoverZorg + WallT.UoverZstep * i;
|
|
|
|
bot = WallT.InvZorg + WallT.InvZstep * i;
|
2010-08-11 03:56:31 +00:00
|
|
|
double cy = centeryfrac / 65536.0;
|
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
for (int x = wallc->sx1; x < wallc->sx2; x++)
|
2010-08-11 03:56:31 +00:00
|
|
|
{
|
|
|
|
double frac = top / bot;
|
2014-08-01 01:11:59 +00:00
|
|
|
double scale = frac * WallT.DepthScale + WallT.DepthOrg;
|
2010-08-11 03:56:31 +00:00
|
|
|
mostbuf[x] = xs_RoundToInt(clamp(zz / scale + cy, 0.0, max));
|
2014-08-01 01:11:59 +00:00
|
|
|
top += WallT.UoverZstep;
|
|
|
|
bot += WallT.InvZstep;
|
2010-08-11 03:56:31 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mostbuf[ix1] < 0) mostbuf[ix1] = 0;
|
|
|
|
else if (mostbuf[ix1] > viewheight) mostbuf[ix1] = (short)viewheight;
|
|
|
|
if (mostbuf[ix2] < 0) mostbuf[ix2] = 0;
|
|
|
|
else if (mostbuf[ix2] > viewheight) mostbuf[ix2] = (short)viewheight;
|
|
|
|
|
|
|
|
return bad;
|
|
|
|
}
|
|
|
|
|
2014-08-01 01:23:04 +00:00
|
|
|
int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if ((plane.a | plane.b) == 0)
|
|
|
|
{
|
2014-08-01 01:23:04 +00:00
|
|
|
return OWallMost (mostbuf, ((plane.c < 0) ? plane.d : -plane.d) - viewz, wallc);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fixed_t x, y, den, z1, z2, oz1, oz2;
|
|
|
|
fixed_t s1, s2, s3, s4;
|
|
|
|
int bad, ix1, ix2, iy1, iy2;
|
|
|
|
|
|
|
|
if (MirrorFlags & RF_XFLIP)
|
|
|
|
{
|
|
|
|
x = curline->v2->x;
|
|
|
|
y = curline->v2->y;
|
2014-08-07 22:12:04 +00:00
|
|
|
if (wallc->sx1 == 0 && 0 != (den = wallc->tx1 - wallc->tx2 + wallc->ty1 - wallc->ty2))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
int frac = SafeDivScale30 (wallc->ty1 + wallc->tx1, den);
|
2006-02-24 04:48:15 +00:00
|
|
|
x -= MulScale30 (frac, x - curline->v1->x);
|
|
|
|
y -= MulScale30 (frac, y - curline->v1->y);
|
|
|
|
}
|
|
|
|
z1 = viewz - plane.ZatPoint (x, y);
|
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
if (wallc->sx2 > wallc->sx1 + 1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
x = curline->v1->x;
|
|
|
|
y = curline->v1->y;
|
2014-08-07 22:12:04 +00:00
|
|
|
if (wallc->sx2 == viewwidth && 0 != (den = wallc->tx1 - wallc->tx2 - wallc->ty1 + wallc->ty2))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
int frac = SafeDivScale30 (wallc->ty2 - wallc->tx2, den);
|
2006-02-24 04:48:15 +00:00
|
|
|
x += MulScale30 (frac, curline->v2->x - x);
|
|
|
|
y += MulScale30 (frac, curline->v2->y - y);
|
|
|
|
}
|
|
|
|
z2 = viewz - plane.ZatPoint (x, y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
z2 = z1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x = curline->v1->x;
|
|
|
|
y = curline->v1->y;
|
2014-08-07 22:12:04 +00:00
|
|
|
if (wallc->sx1 == 0 && 0 != (den = wallc->tx1 - wallc->tx2 + wallc->ty1 - wallc->ty2))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
int frac = SafeDivScale30 (wallc->ty1 + wallc->tx1, den);
|
2006-02-24 04:48:15 +00:00
|
|
|
x += MulScale30 (frac, curline->v2->x - x);
|
|
|
|
y += MulScale30 (frac, curline->v2->y - y);
|
|
|
|
}
|
|
|
|
z1 = viewz - plane.ZatPoint (x, y);
|
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
if (wallc->sx2 > wallc->sx1 + 1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
x = curline->v2->x;
|
|
|
|
y = curline->v2->y;
|
2014-08-07 22:12:04 +00:00
|
|
|
if (wallc->sx2 == viewwidth && 0 != (den = wallc->tx1 - wallc->tx2 - wallc->ty1 + wallc->ty2))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
int frac = SafeDivScale30 (wallc->ty2 - wallc->tx2, den);
|
2006-02-24 04:48:15 +00:00
|
|
|
x -= MulScale30 (frac, x - curline->v1->x);
|
|
|
|
y -= MulScale30 (frac, y - curline->v1->y);
|
|
|
|
}
|
|
|
|
z2 = viewz - plane.ZatPoint (x, y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
z2 = z1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
s1 = MulScale12 (globaluclip, wallc->sz1); s2 = MulScale12 (globaluclip, wallc->sz2);
|
|
|
|
s3 = MulScale12 (globaldclip, wallc->sz1); s4 = MulScale12 (globaldclip, wallc->sz2);
|
2006-02-24 04:48:15 +00:00
|
|
|
bad = (z1<s1)+((z2<s2)<<1)+((z1>s3)<<2)+((z2>s4)<<3);
|
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
ix1 = wallc->sx1; ix2 = wallc->sx2;
|
|
|
|
iy1 = wallc->sz1; iy2 = wallc->sz2;
|
2006-02-24 04:48:15 +00:00
|
|
|
oz1 = z1; oz2 = z2;
|
|
|
|
|
|
|
|
if ((bad&3) == 3)
|
|
|
|
{
|
|
|
|
memset (&mostbuf[ix1], -1, (ix2-ix1)*sizeof(mostbuf[0]));
|
|
|
|
return bad;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((bad&12) == 12)
|
|
|
|
{
|
|
|
|
clearbufshort (&mostbuf[ix1], ix2-ix1, viewheight);
|
|
|
|
return bad;
|
2011-11-04 01:12:53 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bad&3)
|
|
|
|
{
|
|
|
|
//inty = intz / (globaluclip>>16)
|
|
|
|
int t = SafeDivScale30 (oz1-s1, s2-s1+oz1-oz2);
|
2014-08-07 22:12:04 +00:00
|
|
|
int inty = wallc->sz1 + MulScale30 (wallc->sz2-wallc->sz1,t);
|
2006-02-24 04:48:15 +00:00
|
|
|
int intz = oz1 + MulScale30 (oz2-oz1,t);
|
2014-08-07 22:12:04 +00:00
|
|
|
int xcross = wallc->sx1 + Scale (MulScale30 (wallc->sz2, t), wallc->sx2-wallc->sx1, inty);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//t = divscale30((x1<<4)-xcross*yb1[w],xcross*(yb2[w]-yb1[w])-((x2-x1)<<4));
|
|
|
|
//inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t);
|
|
|
|
//intz = z1 + mulscale30(z2-z1,t);
|
|
|
|
|
|
|
|
if ((bad&3) == 2)
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
if (wallc->sx1 <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
|
|
|
|
memset (&mostbuf[xcross], 0, (wallc->sx2-xcross)*sizeof(mostbuf[0]));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
if (xcross <= wallc->sx2) { z1 = intz; iy1 = inty; ix1 = xcross; }
|
|
|
|
memset (&mostbuf[wallc->sx1], 0, (xcross-wallc->sx1)*sizeof(mostbuf[0]));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bad&12)
|
|
|
|
{
|
|
|
|
//inty = intz / (globaldclip>>16)
|
|
|
|
int t = SafeDivScale30 (oz1-s3, s4-s3+oz1-oz2);
|
2014-08-07 22:12:04 +00:00
|
|
|
int inty = wallc->sz1 + MulScale30 (wallc->sz2-wallc->sz1,t);
|
2006-02-24 04:48:15 +00:00
|
|
|
int intz = oz1 + MulScale30 (oz2-oz1,t);
|
2014-08-07 22:12:04 +00:00
|
|
|
int xcross = wallc->sx1 + Scale (MulScale30 (wallc->sz2, t), wallc->sx2-wallc->sx1,inty);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//t = divscale30((x1<<4)-xcross*yb1[w],xcross*(yb2[w]-yb1[w])-((x2-x1)<<4));
|
|
|
|
//inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t);
|
|
|
|
//intz = z1 + mulscale30(z2-z1,t);
|
|
|
|
|
|
|
|
if ((bad&12) == 8)
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
if (wallc->sx1 <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
|
|
|
|
if (wallc->sx2 > xcross) clearbufshort (&mostbuf[xcross], wallc->sx2-xcross, viewheight);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-08-07 22:12:04 +00:00
|
|
|
if (xcross <= wallc->sx2) { z1 = intz; iy1 = inty; ix1 = xcross; }
|
|
|
|
if (xcross > wallc->sx1) clearbufshort (&mostbuf[wallc->sx1], xcross-wallc->sx1, viewheight);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
y = Scale (z1>>4, InvZtoScale, iy1);
|
|
|
|
if (ix2 == ix1)
|
|
|
|
{
|
|
|
|
mostbuf[ix1] = (short)((y + centeryfrac) >> FRACBITS);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fixed_t yinc = (Scale (z2>>4, InvZtoScale, iy2) - y) / (ix2-ix1);
|
|
|
|
qinterpolatedown16short (&mostbuf[ix1], ix2-ix1, y + centeryfrac,yinc);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mostbuf[ix1] < 0) mostbuf[ix1] = 0;
|
|
|
|
else if (mostbuf[ix1] > viewheight) mostbuf[ix1] = (short)viewheight;
|
|
|
|
if (mostbuf[ix2] < 0) mostbuf[ix2] = 0;
|
|
|
|
else if (mostbuf[ix2] > viewheight) mostbuf[ix2] = (short)viewheight;
|
|
|
|
|
|
|
|
return bad;
|
|
|
|
}
|
|
|
|
|
2014-08-01 01:32:21 +00:00
|
|
|
static void PrepWallRoundFix(fixed_t *lwall, fixed_t walxrepeat, int x1, int x2)
|
2010-08-01 02:41:56 +00:00
|
|
|
{
|
2006-02-24 04:48:15 +00:00
|
|
|
// fix for rounding errors
|
2012-08-23 01:34:19 +00:00
|
|
|
walxrepeat = abs(walxrepeat);
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t fix = (MirrorFlags & RF_XFLIP) ? walxrepeat-1 : 0;
|
2010-08-01 02:41:56 +00:00
|
|
|
int x;
|
|
|
|
|
2014-08-01 01:32:21 +00:00
|
|
|
if (x1 > 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2014-08-01 01:32:21 +00:00
|
|
|
for (x = x1; x < x2; x++)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if ((unsigned)lwall[x] >= (unsigned)walxrepeat)
|
|
|
|
{
|
|
|
|
lwall[x] = fix;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fix = walxrepeat - 1 - fix;
|
2014-08-01 01:32:21 +00:00
|
|
|
for (x = x2-1; x >= x1; x--)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if ((unsigned)lwall[x] >= (unsigned)walxrepeat)
|
|
|
|
{
|
|
|
|
lwall[x] = fix;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-01 01:32:21 +00:00
|
|
|
void PrepWall (fixed_t *swall, fixed_t *lwall, fixed_t walxrepeat, int x1, int x2)
|
2010-08-01 02:41:56 +00:00
|
|
|
{ // swall = scale, lwall = texturecolumn
|
|
|
|
double top, bot, i;
|
2012-08-23 01:34:19 +00:00
|
|
|
double xrepeat = fabs((double)walxrepeat);
|
2014-08-08 03:58:11 +00:00
|
|
|
double depth_scale = WallT.InvZstep * WallTMapScale2;
|
|
|
|
double depth_org = -WallT.UoverZstep * WallTMapScale2;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2014-08-01 01:32:21 +00:00
|
|
|
i = x1 - centerx;
|
2014-08-01 01:11:59 +00:00
|
|
|
top = WallT.UoverZorg + WallT.UoverZstep * i;
|
|
|
|
bot = WallT.InvZorg + WallT.InvZstep * i;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2014-08-01 01:32:21 +00:00
|
|
|
for (int x = x1; x < x2; x++)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-08-01 02:41:56 +00:00
|
|
|
double frac = top / bot;
|
2012-08-23 01:34:19 +00:00
|
|
|
if (walxrepeat < 0)
|
|
|
|
{
|
|
|
|
lwall[x] = xs_RoundToInt(xrepeat - frac * xrepeat);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lwall[x] = xs_RoundToInt(frac * xrepeat);
|
|
|
|
}
|
2014-08-08 03:58:11 +00:00
|
|
|
swall[x] = xs_RoundToInt(frac * depth_scale + depth_org);
|
2014-08-01 01:11:59 +00:00
|
|
|
top += WallT.UoverZstep;
|
|
|
|
bot += WallT.InvZstep;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2014-08-01 01:32:21 +00:00
|
|
|
PrepWallRoundFix(lwall, walxrepeat, x1, x2);
|
2010-08-01 02:41:56 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2014-08-01 01:32:21 +00:00
|
|
|
void PrepLWall (fixed_t *lwall, fixed_t walxrepeat, int x1, int x2)
|
2010-08-01 02:41:56 +00:00
|
|
|
{ // lwall = texturecolumn
|
|
|
|
double top, bot, i;
|
2012-08-23 01:34:19 +00:00
|
|
|
double xrepeat = fabs((double)walxrepeat);
|
2010-08-01 02:41:56 +00:00
|
|
|
double topstep;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2014-08-01 01:32:21 +00:00
|
|
|
i = x1 - centerx;
|
2014-08-01 01:11:59 +00:00
|
|
|
top = WallT.UoverZorg + WallT.UoverZstep * i;
|
|
|
|
bot = WallT.InvZorg + WallT.InvZstep * i;
|
2010-08-01 02:41:56 +00:00
|
|
|
|
|
|
|
top *= xrepeat;
|
2014-08-01 01:11:59 +00:00
|
|
|
topstep = WallT.UoverZstep * xrepeat;
|
2010-08-01 02:41:56 +00:00
|
|
|
|
2014-08-01 01:32:21 +00:00
|
|
|
for (int x = x1; x < x2; x++)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2012-08-23 01:34:19 +00:00
|
|
|
if (walxrepeat < 0)
|
|
|
|
{
|
|
|
|
lwall[x] = xs_RoundToInt(xrepeat - top / bot);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lwall[x] = xs_RoundToInt(top / bot);
|
|
|
|
}
|
2010-08-01 02:41:56 +00:00
|
|
|
top += topstep;
|
2014-08-01 01:11:59 +00:00
|
|
|
bot += WallT.InvZstep;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2014-08-01 01:32:21 +00:00
|
|
|
PrepWallRoundFix(lwall, walxrepeat, x1, x2);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// pass = 0: when seg is first drawn
|
|
|
|
// = 1: drawing masked textures (including sprites)
|
|
|
|
// Currently, only pass = 0 is done or used
|
|
|
|
|
2006-04-13 02:01:40 +00:00
|
|
|
static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper, int pass)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-04-13 02:01:40 +00:00
|
|
|
fixed_t lx, ly, lx2, ly2, decalx, decaly;
|
2006-02-24 04:48:15 +00:00
|
|
|
int x1, x2;
|
2006-04-13 02:01:40 +00:00
|
|
|
fixed_t xscale, yscale;
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t topoff;
|
2006-09-14 00:02:31 +00:00
|
|
|
BYTE flipx;
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t zpos;
|
|
|
|
int needrepeat = 0;
|
|
|
|
sector_t *front, *back;
|
2009-10-29 06:32:50 +00:00
|
|
|
bool calclighting;
|
2009-11-02 17:02:12 +00:00
|
|
|
bool rereadcolormap;
|
2009-11-01 06:45:47 +00:00
|
|
|
FDynamicColormap *usecolormap;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-06-15 18:36:26 +00:00
|
|
|
if (decal->RenderFlags & RF_INVISIBLE || !viewactive || !decal->PicNum.isValid())
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Determine actor z
|
2006-04-13 02:01:40 +00:00
|
|
|
zpos = decal->Z;
|
2006-02-24 04:48:15 +00:00
|
|
|
front = curline->frontsector;
|
|
|
|
back = (curline->backsector != NULL) ? curline->backsector : curline->frontsector;
|
2006-04-12 01:50:09 +00:00
|
|
|
switch (decal->RenderFlags & RF_RELMASK)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
default:
|
2006-04-13 02:01:40 +00:00
|
|
|
zpos = decal->Z;
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
case RF_RELUPPER:
|
|
|
|
if (curline->linedef->flags & ML_DONTPEGTOP)
|
|
|
|
{
|
2008-08-16 20:19:35 +00:00
|
|
|
zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-16 20:19:35 +00:00
|
|
|
zpos = decal->Z + back->GetPlaneTexZ(sector_t::ceiling);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RF_RELLOWER:
|
|
|
|
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
|
|
|
{
|
2008-08-16 20:19:35 +00:00
|
|
|
zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-16 20:19:35 +00:00
|
|
|
zpos = decal->Z + back->GetPlaneTexZ(sector_t::floor);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RF_RELMID:
|
|
|
|
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
|
|
|
{
|
2008-08-16 20:19:35 +00:00
|
|
|
zpos = decal->Z + front->GetPlaneTexZ(sector_t::floor);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-16 20:19:35 +00:00
|
|
|
zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-13 02:01:40 +00:00
|
|
|
xscale = decal->ScaleX;
|
|
|
|
yscale = decal->ScaleY;
|
2006-04-12 01:50:09 +00:00
|
|
|
|
2011-11-04 01:12:53 +00:00
|
|
|
WallSpriteTile = TexMan(decal->PicNum, true);
|
2006-09-14 00:02:31 +00:00
|
|
|
flipx = (BYTE)(decal->RenderFlags & RF_XFLIP);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-10-31 00:47:05 +00:00
|
|
|
if (WallSpriteTile == NULL || WallSpriteTile->UseType == FTexture::TEX_Null)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Determine left and right edges of sprite. Since this sprite is bound
|
2006-04-12 01:50:09 +00:00
|
|
|
// to a wall, we use the wall's angle instead of the decal's. This is
|
2006-02-24 04:48:15 +00:00
|
|
|
// pretty much the same as what R_AddLine() does.
|
|
|
|
|
2014-08-01 01:11:59 +00:00
|
|
|
FWallCoords savecoord = WallC;
|
2009-10-27 01:53:47 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
x2 = WallSpriteTile->GetWidth();
|
|
|
|
x1 = WallSpriteTile->LeftOffset;
|
|
|
|
x2 = x2 - x1;
|
|
|
|
|
|
|
|
x1 *= xscale;
|
|
|
|
x2 *= xscale;
|
|
|
|
|
2006-04-13 02:01:40 +00:00
|
|
|
decal->GetXY (wall, decalx, decaly);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
angle_t ang = R_PointToAngle2 (curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y) >> ANGLETOFINESHIFT;
|
2006-04-13 02:01:40 +00:00
|
|
|
lx = decalx - FixedMul (x1, finecosine[ang]) - viewx;
|
|
|
|
lx2 = decalx + FixedMul (x2, finecosine[ang]) - viewx;
|
|
|
|
ly = decaly - FixedMul (x1, finesine[ang]) - viewy;
|
|
|
|
ly2 = decaly + FixedMul (x2, finesine[ang]) - viewy;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2014-08-01 02:02:22 +00:00
|
|
|
if (WallC.Init(lx, ly, lx2, ly2, TOO_CLOSE_Z))
|
2009-10-27 01:53:47 +00:00
|
|
|
goto done;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
x1 = WallC.sx1;
|
|
|
|
x2 = WallC.sx2;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2014-08-01 02:02:22 +00:00
|
|
|
if (x1 > clipper->x2 || x2 <= clipper->x1)
|
2009-10-27 01:53:47 +00:00
|
|
|
goto done;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2014-08-01 02:02:22 +00:00
|
|
|
WallT.InitFromWallCoords(&WallC);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Get the top and bottom clipping arrays
|
2006-04-12 01:50:09 +00:00
|
|
|
switch (decal->RenderFlags & RF_CLIPMASK)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
case RF_CLIPFULL:
|
|
|
|
if (curline->backsector == NULL)
|
|
|
|
{
|
|
|
|
if (pass != 0)
|
|
|
|
{
|
2009-10-27 01:53:47 +00:00
|
|
|
goto done;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
mceilingclip = walltop;
|
|
|
|
mfloorclip = wallbottom;
|
|
|
|
}
|
|
|
|
else if (pass == 0)
|
|
|
|
{
|
|
|
|
mceilingclip = walltop;
|
|
|
|
mfloorclip = ceilingclip;
|
|
|
|
needrepeat = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mceilingclip = openings + clipper->sprtopclip - clipper->x1;
|
|
|
|
mfloorclip = openings + clipper->sprbottomclip - clipper->x1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RF_CLIPUPPER:
|
|
|
|
if (pass != 0)
|
|
|
|
{
|
2009-10-27 01:53:47 +00:00
|
|
|
goto done;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
mceilingclip = walltop;
|
|
|
|
mfloorclip = ceilingclip;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RF_CLIPMID:
|
|
|
|
if (curline->backsector != NULL && pass != 2)
|
|
|
|
{
|
2009-10-27 01:53:47 +00:00
|
|
|
goto done;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
mceilingclip = openings + clipper->sprtopclip - clipper->x1;
|
|
|
|
mfloorclip = openings + clipper->sprbottomclip - clipper->x1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RF_CLIPLOWER:
|
|
|
|
if (pass != 0)
|
|
|
|
{
|
2009-10-27 01:53:47 +00:00
|
|
|
goto done;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
mceilingclip = floorclip;
|
|
|
|
mfloorclip = wallbottom;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
topoff = WallSpriteTile->TopOffset << FRACBITS;
|
2006-04-13 02:01:40 +00:00
|
|
|
dc_texturemid = topoff + FixedDiv (zpos - viewz, yscale);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Clip sprite to drawseg
|
|
|
|
if (x1 < clipper->x1)
|
|
|
|
{
|
|
|
|
x1 = clipper->x1;
|
|
|
|
}
|
|
|
|
if (x2 > clipper->x2)
|
|
|
|
{
|
|
|
|
x2 = clipper->x2 + 1;
|
|
|
|
}
|
|
|
|
if (x1 >= x2)
|
|
|
|
{
|
2009-10-27 01:53:47 +00:00
|
|
|
goto done;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2014-08-01 01:32:21 +00:00
|
|
|
PrepWall (swall, lwall, WallSpriteTile->GetWidth() << FRACBITS, x1, x2);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (flipx)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int right = (WallSpriteTile->GetWidth() << FRACBITS) - 1;
|
|
|
|
|
|
|
|
for (i = x1; i < x2; i++)
|
|
|
|
{
|
|
|
|
lwall[i] = right - lwall[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Prepare lighting
|
2009-10-29 06:32:50 +00:00
|
|
|
calclighting = false;
|
2009-11-01 06:45:47 +00:00
|
|
|
usecolormap = basecolormap;
|
2009-11-02 17:02:12 +00:00
|
|
|
rereadcolormap = true;
|
2009-10-30 03:46:51 +00:00
|
|
|
|
|
|
|
// Decals that are added to the scene must fade to black.
|
2009-10-30 03:53:00 +00:00
|
|
|
if (decal->RenderStyle == LegacyRenderStyles[STYLE_Add] && usecolormap->Fade != 0)
|
2009-10-30 03:46:51 +00:00
|
|
|
{
|
|
|
|
usecolormap = GetSpecialLights(usecolormap->Color, 0, usecolormap->Desaturate);
|
2009-11-02 01:02:23 +00:00
|
|
|
rereadcolormap = false;
|
2009-10-30 03:46:51 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2014-08-07 22:12:04 +00:00
|
|
|
rw_light = rw_lightleft + (x1 - WallC.sx1) * rw_lightstep;
|
2009-09-20 03:50:05 +00:00
|
|
|
if (fixedlightlev >= 0)
|
2009-10-30 03:46:51 +00:00
|
|
|
dc_colormap = usecolormap->Maps + fixedlightlev;
|
2009-09-20 03:50:05 +00:00
|
|
|
else if (fixedcolormap != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
dc_colormap = fixedcolormap;
|
2006-04-12 01:50:09 +00:00
|
|
|
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
|
2009-10-30 03:46:51 +00:00
|
|
|
dc_colormap = usecolormap->Maps;
|
2006-02-24 04:48:15 +00:00
|
|
|
else
|
|
|
|
calclighting = true;
|
|
|
|
|
|
|
|
// Draw it
|
2006-04-12 01:50:09 +00:00
|
|
|
if (decal->RenderFlags & RF_YFLIP)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
sprflipvert = true;
|
|
|
|
yscale = -yscale;
|
|
|
|
dc_texturemid = dc_texturemid - (WallSpriteTile->GetHeight() << FRACBITS);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprflipvert = false;
|
|
|
|
}
|
|
|
|
|
2006-04-13 02:01:40 +00:00
|
|
|
// rw_offset is used as the texture's vertical scale
|
|
|
|
rw_offset = SafeDivScale30(1, yscale);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
dc_x = x1;
|
|
|
|
ESPSResult mode;
|
|
|
|
|
2006-04-12 01:50:09 +00:00
|
|
|
mode = R_SetPatchStyle (decal->RenderStyle, decal->Alpha, decal->Translation, decal->AlphaColor);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-11-02 01:02:23 +00:00
|
|
|
// R_SetPatchStyle can modify basecolormap.
|
|
|
|
if (rereadcolormap)
|
|
|
|
{
|
|
|
|
usecolormap = basecolormap;
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
if (mode == DontDraw)
|
|
|
|
{
|
|
|
|
needrepeat = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int stop4;
|
|
|
|
|
|
|
|
if (mode == DoDraw0)
|
|
|
|
{ // 1 column at a time
|
|
|
|
stop4 = dc_x;
|
|
|
|
}
|
|
|
|
else // DoDraw1
|
|
|
|
{ // up to 4 columns at a time
|
|
|
|
stop4 = x2 & ~3;
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((dc_x < stop4) && (dc_x & 3))
|
|
|
|
{
|
|
|
|
if (calclighting)
|
|
|
|
{ // calculate lighting
|
2009-10-30 03:46:51 +00:00
|
|
|
dc_colormap = usecolormap->Maps + (GETPALOOKUP (rw_light, wallshade) << COLORMAPSHIFT);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2014-08-03 03:35:57 +00:00
|
|
|
R_WallSpriteColumn (R_DrawMaskedColumn);
|
2006-02-24 04:48:15 +00:00
|
|
|
dc_x++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (dc_x < stop4)
|
|
|
|
{
|
|
|
|
if (calclighting)
|
|
|
|
{ // calculate lighting
|
2009-10-30 03:46:51 +00:00
|
|
|
dc_colormap = usecolormap->Maps + (GETPALOOKUP (rw_light, wallshade) << COLORMAPSHIFT);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
rt_initcols();
|
|
|
|
for (int zz = 4; zz; --zz)
|
|
|
|
{
|
2014-08-03 03:35:57 +00:00
|
|
|
R_WallSpriteColumn (R_DrawMaskedColumnHoriz);
|
2006-02-24 04:48:15 +00:00
|
|
|
dc_x++;
|
|
|
|
}
|
|
|
|
rt_draw4cols (dc_x - 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
while (dc_x < x2)
|
|
|
|
{
|
|
|
|
if (calclighting)
|
|
|
|
{ // calculate lighting
|
2009-10-30 03:46:51 +00:00
|
|
|
dc_colormap = usecolormap->Maps + (GETPALOOKUP (rw_light, wallshade) << COLORMAPSHIFT);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2014-08-03 03:35:57 +00:00
|
|
|
R_WallSpriteColumn (R_DrawMaskedColumn);
|
2006-02-24 04:48:15 +00:00
|
|
|
dc_x++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If this sprite is RF_CLIPFULL on a two-sided line, needrepeat will
|
|
|
|
// be set 1 if we need to draw on the lower wall. In all other cases,
|
|
|
|
// needrepeat will be 0, and the while will fail.
|
|
|
|
mceilingclip = floorclip;
|
|
|
|
mfloorclip = wallbottom;
|
|
|
|
R_FinishSetPatchStyle ();
|
|
|
|
} while (needrepeat--);
|
|
|
|
|
|
|
|
colfunc = basecolfunc;
|
|
|
|
hcolfunc_post1 = rt_map1col;
|
|
|
|
hcolfunc_post4 = rt_map4cols;
|
|
|
|
|
|
|
|
R_FinishSetPatchStyle ();
|
2009-10-27 01:53:47 +00:00
|
|
|
done:
|
2014-08-01 01:11:59 +00:00
|
|
|
WallC = savecoord;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|