Commit Graph

63 Commits

Author SHA1 Message Date
Christoph Oelckers e9be49f37d - fixed: R_DeinitPlanes did not free all visplanes because it called R_ClearPlanes with 'fullclear' set to false.
- removed some redundancy from R_ClearPlanes.
2013-07-14 09:47:39 +02:00
Randy Heit a50e670c0c - Use tests less prone to overflow on very steep slopes when detecting which side of a plane
the camera is on. Mostly, this means testing the distance of the camera to the plane rather
  than computing the plane's Z at the camera and comparing that with the camera's Z.

SVN r4220 (trunk)
2013-04-17 01:32:40 +00:00
Randy Heit 1107bebfcf - Redo r4164 fix: Don't clear fake planes when clearing skybox planes.
SVN r4172 (trunk)
2013-03-02 01:54:40 +00:00
Randy Heit 2919bdf4fe - Fixed: Skyboxes never cleared planes when a 3D floor was in view.
SVN r4164 (trunk)
2013-02-23 05:15:32 +00:00
Randy Heit 4f3a03f2f4 - Fixed: stat skyboxes output was broken.
SVN r4163 (trunk)
2013-02-23 04:24:40 +00:00
Randy Heit e2a018227f - Added additive blending for floors and ceilings.
SVN r3813 (trunk)
2012-08-09 04:31:31 +00:00
Randy Heit 9acf65b9a4 - Added support for a PALVERS lump. This specifies replacement textures to
be used when for walls and floors when the renderer is paletted. The format
  is very simple:
    rgbtex1 paltex1
    rgbtex2 paltex2
    ...
  The first texture is the one to be used normally, and the second is the one
  to be used in paletted modes.

  The vid_nopalsubstitutions cvar can be used to ignore this lump.



SVN r3311 (trunk)
2011-11-04 01:12:53 +00:00
Christoph Oelckers 463c276014 - removed more r_ header dependencies from the rest of the code.
SVN r3260 (trunk)
2011-07-06 15:31:05 +00:00
Christoph Oelckers 5c6fd66ed5 - rename src/resources to src/r_data.
SVN r3254 (trunk)
2011-07-06 07:35:36 +00:00
Christoph Oelckers b57a39dd86 - moved R_AlignFlat out of renderer into main game code (r_ to p_.)
SVN r3249 (trunk)
2011-07-05 13:33:02 +00:00
Christoph Oelckers 4626492f50 - separated all colormap related code from v_palette.cpp and r_data.cpp into its own file.
SVN r3245 (trunk)
2011-07-03 10:47:35 +00:00
Randy Heit 3401e92834 - Emulate the size limit of Doom's lightscale table by capping the value of vis passed to
GETPALOOKUP. The end result is that there is a minimum distance around you where light
  amplification stops and it gets no brighter. Should this scale with visibility? I can't say.

  So, yeah, it turns out all these years ago, I made this out to be harder than it really is.

SVN r3224 (trunk)
2011-06-12 03:15:15 +00:00
Christoph Oelckers 1806e47e43 - fixed: Sector_SetLink did incorrect checks for the returned control sector
- added Sector_SetTranslucent special so set translucency of portal planes at run time.
- added 'additive' information for portal planes. This is no-op at the moment because the flat drawers can't handle additive translucency yet though.


SVN r3149 (trunk)
2011-02-12 09:53:40 +00:00
Christoph Oelckers fae8ed444c - merged 3dfloors2 branch into trunk.
SVN r3124 (trunk)
2011-01-29 11:09:38 +00:00
Christoph Oelckers e46183d836 - removed all portal fudging that was necessary to make thing based portals work the same as line based portals. Using an actor flag on the skybox thing the visplane code now checks what kind of portal is used and uses the proper logic accordingly. As a result the "Portals" compatibility flag no longer exists.
SVN r3072 (trunk)
2010-12-24 13:43:36 +00:00
Christoph Oelckers 74822572da - restore old portal checks for Action Doom 2 (as a hidden compatibility option.)
SVN r3018 (trunk)
2010-12-02 15:08:44 +00:00
Randy Heit d9c811fc61 - Increase MAX_SKYBOX_PLANES to 1000.
SVN r3016 (trunk)
2010-12-02 02:08:54 +00:00
Christoph Oelckers ef133dc682 - changed skybox code to use the alpha from the sector plane.
- removed alpha from skybox viewpoints.


SVN r2993 (trunk)
2010-11-07 17:05:21 +00:00
Christoph Oelckers c31c4755fa - add an alpha parameter to R_FindPlane.
- fixed: R_FindPlane must do a full visplane comparison for stacked sectors with a non-0 alpha for the sector plane.


SVN r2991 (trunk)
2010-11-07 16:11:42 +00:00
Christoph Oelckers 669ce73272 - made the alpha used by stacked sectors part of the visplane. This will be needed to fix the merging of stacks with the same displacement but different alpha values.
SVN r2990 (trunk)
2010-11-07 15:30:41 +00:00
Christoph Oelckers 9a4abe0915 - merged automap branch into trunk.
SVN r2609 (trunk)
2010-08-27 15:20:05 +00:00
Randy Heit 9a025fbb23 - Changed xtoviewangle[] calculation so that when it mirrors the array to the left half, it
does not include xtoviewangle[centerx] in the mirroring so that the two columns at the center
  of the screen do not map to the same angle. (BTW, this array is only used for the sky drawing.)

SVN r2487 (trunk)
2010-08-01 20:21:04 +00:00
Christoph Oelckers 26c33afafb - fixed: Movement performed by actor movers was not interpolated because
it happened outside the moved actor's Tick function. This got particularly
  obvious with moving skybox viewpoints (See Daedalus's MAP21 intro for a good
  example.)


SVN r2059 (trunk)
2009-12-30 12:20:47 +00:00
Randy Heit 344dda4a1a - Replaced toint/quickertoint with the portable routines from xs_Float.h. The
former used fistp, which is not portable across platforms, so cannot be
  used in the play simulation. They were only suitable for the renderer.
  xs_Float.h also has a very fast float->fixed conversion, so FLOAT2FIXED
  uses that now.
  (And I also learned that the FPU's round to nearest is not the rounding I
  learned in grade school but actually Banker's Rounding. I had no idea.)
  (Also, also, the only thing that could have made quickertoint faster than
  toint was that it stored a 32-bit int. I never timed them, and I doubt in
  practice there was any real difference between the two.)
- Changed atan2f to atan2. Using floats is not a win, because the result is
  returned as a double on the x87 stack, which the caller then needs to cast
  down to a float using fst/fld.

SVN r1990 (trunk)
2009-11-20 05:34:20 +00:00
Christoph Oelckers 6161702703 - fixed: The sky baseline position needs to take texture scaling into account.
SVN r1982 (trunk)
2009-11-15 08:11:14 +00:00
Randy Heit 84fda053ba - More sky changes: Textures taller than 200 pixels but shorter than 241
are scaled to the height of a 200 pixel tall sky. Skies taller than 240
  use the same scale as a 240 tall sky but are shifted down to make the
  top of the texture align with the top of the screen when looking fully up.
  Thus, by using a sky texture with a height of 240 or more pixels, the sky
  will be drawn with square pixels instead of the vertically elongated ones
  imposed by Doom's native 320x200 resolution.


SVN r1978 (trunk)
2009-11-14 03:08:35 +00:00
Randy Heit 363dfcffbd November 12, 2009
- Improved sky stretching a bit: It now only stretches the sky as tall as it
  needs to be: 228 pixels, not 256. It no longer stretches horizontally,
  either.
  
  The reason it stretches to 228 and not 200 pixels is because Doom shifted
  its sky texture down 28 pixels. By stretching to 228 pixels, we can keep
  the sky tiled at the same height on the horizon. Skies 200 pixels tall
  (or more) will continue to tile at the center of the screen when looking
  directly ahead.


SVN r1976 (trunk)
2009-11-13 04:38:03 +00:00
Randy Heit 281b2f5637 - Fixed: MBF sky Y offsets were ignored. X offsets should also be applied to
the sky cylinder, not the screen like Hexen scrolling skies.


SVN r1970 (trunk)
2009-11-12 01:05:55 +00:00
Randy Heit de8ec46c06 - Fixed: R_GetOneSkyColumn() and R_GetTwoSkyColumns are mulscaling an
unsigned integer that can use all 32 bits. They must therefore use
  the unsigned mul instruction rather than the signed imul instruction.
- Fixed several signed/unsigned comparison and possibly uninitialized
  variable warnings flagged by GCC.


SVN r1965 (trunk)
2009-11-08 02:51:22 +00:00
Randy Heit f40462dfb4 - Rewrote wide sky texture scaling again. This time, it should work for any
size textures at any scale. I also tried doing sky scrolling on the sky
  cylinder, but that didn't look so good, so I left it in screen space.


SVN r1932 (trunk)
2009-10-24 23:42:58 +00:00
Randy Heit 1c9b693087 - Fixed drawing of wide high resolution skies. (At least for the samples I
received. I'm not convinced that it's yet fixed for the general case.)


SVN r1930 (trunk)
2009-10-24 04:39:36 +00:00
Randy Heit b8eb530a0d - Fixed: Wall drawing handled fixed light levels improperly (but did not
completely ignore them, either).
- Separated light level fixing out of player_t's fixedcolormap parameter.
  Using a fixed light level (e.g. PowerTorch) will no longer wipe out
  colored lighting.
- Moved the blending rectangle drawing into a separate discrete stage, since
  doing it while copying the 3D view window to the display now blends
  underneath the weapon instead of on top of it.
- Consolidated the special colormaps into a single 2D table.
- Tweaked the special colormaps slightly to make the true color results more
  closely match the paletted approximations.
- fb_d3d9_shaders.h was getting unwieldy, so I moved the shaders out of the
  executable and into zdoom.pk3. Shaders are still precompiled so I don't need
  to pull in a dependancy on D3DX.
- Added a few more shaders to accomodate drawing weapons with all the in-game
  lighting models. These are accessed with the new DrawTexture tags
  DTA_SpecialColormap and DTA_ColormapStyle.
- Player weapon sprites are now drawn using Direct3D and receive all the
  benefits thereof.


SVN r1858 (trunk)
2009-09-20 03:50:05 +00:00
Christoph Oelckers 14a42bbada - changed line_t's sidenum into sidedef pointers.
SVN r1801 (trunk)
2009-09-06 20:45:56 +00:00
Christoph Oelckers f4c9cf9c4e - Fixed: R_DrawSkyStriped used frontyScale without initializing it first.
- Fixed: P_LineAttack may not check the puff actor for MF6_FORCEPAIN because
  it's not necessarily spawned yet. 
- Fixed: FWeaponSlots::PickNext/PrevWeapon must be limited to one iteration
  through the weapon slots. Otherwise they will hang if there's no weapons
  in a player's inventory.


SVN r1659 (trunk)
2009-06-09 07:45:04 +00:00
Randy Heit c66f237873 - Added per-tier texture scaling with these new UDMF sidedef properties:
* scalex_top
  * scaley_top
  * scalex_mid
  * scaley_mid
  * scalex_bottom
  * scalex_bottom
- Added sidedef versions of the linedef flags wrapmidtex and clipmidtex (via
  UDMF; names are the same). If the flag is set on the line, it applies to
  both sides. Otherwise, each side can control them individually.


SVN r1645 (trunk)
2009-06-07 01:14:14 +00:00
Christoph Oelckers a732687548 - Changed APlayerPawn::DamageFade to a PalEntry from 3 floats.
- Removed #pragma warnings from cmdlib.h and fixed the places where they were 
  still triggered.
  These #pragmas were responsible for >90% of the GCC warnings that were not
  listed in VC++.
- Fixed one bug in the process: DSeqNode::m_Atten was never adjusted when the
  parameter handling of the sound functions for attenuation was changed.
  Changed m_Atten to a float and fixed the SNDSEQ parser to set proper values. 
  Also added the option to specify attenuation with direct values in addition 
  to the predefined names.

SVN r1583 (trunk)
2009-05-15 10:39:40 +00:00
Christoph Oelckers 760f70d3f1 - Changed compilation for g_doom, g_heretic, g_hexen and g_strife folders
so that all files are included by a central one instead of compiling 
  each one separately. This speeds up the compilation process by 25%
  when doing a complete rebuild in Visual C.
- Cleaned up more header dependencies.

SVN r1226 (trunk)
2008-09-15 14:11:05 +00:00
Christoph Oelckers db5723997c - Cleaned up some include dependencies.
SVN r1224 (trunk)
2008-09-14 23:54:38 +00:00
Randy Heit dda5ddd3c2 - Ported vlinetallasm4 to AMD64 assembly. Even with the increased number of
registers AMD64 provides, this routine still needs to be written as self-
  modifying code for maximum performance. The additional registers do allow
  for further optimization over the x86 version by allowing all four pixels
  to be in flight at the same time. The end result is that AMD64 ASM is about
  2.18 times faster than AMD64 C and about 1.06 times faster than x86 ASM.
  (For further comparison, AMD64 C and x86 C are practically the same for
  this function.) Should I port any more assembly to AMD64, mvlineasm4 is the
  most likely candidate, but it's not used enough at this point to bother.
  Also, this may or may not work with Linux at the moment, since it doesn't
  have the eh_handler metadata. Win64 is easier, since I just need to
  structure the function prologue and epilogue properly and use some
  assembler directives/macros to automatically generate the metadata. And
  that brings up another point: You need YASM to assemble the AMD64 code,
  because NASM doesn't support the Win64 metadata directives.
- Added an SSE version of DoBlending. This is strictly C intrinsics.
  VC++ still throws around unneccessary register moves. GCC seems to be
  pretty close to optimal, requiring only about 2 cycles/color. They're
  both faster than my hand-written MMX routine, so I don't need to feel
  bad about not hand-optimizing this for x64 builds.
- Removed an extra instruction from DoBlending_MMX, transposed two
  instructions, and unrolled it once, shaving off about 80 cycles from the
  time required to blend 256 palette entries. Why? Because I tried writing
  a C version of the routine using compiler intrinsics and was appalled by
  all the extra movq's VC++ added to the code. GCC was better, but still
  generated extra instructions. I only wanted a C version because I can't
  use inline assembly with VC++'s x64 compiler, and x64 assembly is a bit
  of a pain. (It's a pain because Linux and Windows have different calling
  conventions, and you need to maintain extra metadata for functions.) So,
  the assembly version stays and the C version stays out.
- Removed all the pixel doubling r_detail modes, since the one platform they
  were intended to assist (486) actually sees very little benefit from them.
- Rewrote CheckMMX in C and renamed it to CheckCPU.
- Fixed: CPUID function 0x80000005 is specified to return detailed L1 cache
  only for AMD processors, so we must not use it on other architectures, or
  we end up overwriting the L1 cache line size with 0 or some other number
  we don't actually understand.


SVN r1134 (trunk)
2008-08-09 03:13:43 +00:00
Christoph Oelckers b030682834 - Fixed: When copying visplanes the sky texture was forgotten.
SVN r1077 (trunk)
2008-07-20 17:52:12 +00:00
Randy Heit a3e8a0cefd - Removed the S_Sound() variant that allows for pointing the origin at an
arbitrary point. It has been replaced with a variant that takes a polyobject
  as a source, since that was the only use that couldn't be rewritten with the
  other variants. This also fixes the bug that polyobject sounds were not
  successfully saved and caused a crash when reloading the game. Note that
  this is a significant change to how equality of sound sources is determined,
  so some things may not behave quite the same as before. (Which would be a
  bug, but hopefully everything still sounds the same.)


SVN r1059 (trunk)
2008-07-01 04:06:56 +00:00
Randy Heit bb689ba3c9 - Fixed all the new warnings tossed out by GCC 4.3.
SVN r1047 (trunk)
2008-06-25 22:16:04 +00:00
Christoph Oelckers 8ca7c05e9d - Changed FImageCollection to return translated texture indices so
that animated icons can be done with it.
- Changed FImageCollection to use a TArray to hold its data.
- Fixed: SetChanHeadSettings did an assignment instead of comparing
  the channel ID witg CHAN_CEILING.
- Changed sound sequence names for animated doors to FNames.
- Automatically fixed: DCeiling didn't properly serialize its texture id.
- Replaced integers as texture ID representation with a specific new type
  to track down all potentially incorrect uses and remaining WORDs used
  for texture IDs so that more than 32767 or 65535 textures can be defined.


SVN r1036 (trunk)
2008-06-15 18:36:26 +00:00
Christoph Oelckers 0e6e1da970 - Fixed: The UDMF parser stored plane rotation angles as fixed_t, not angle_t.
- Grouped the sector plane texture transformation options into a separate
  structure and replaced all access to them with wrapper functions.


SVN r1033 (trunk)
2008-06-14 15:26:16 +00:00
Randy Heit 7160e09b04 - Fixed: When R_DrawTiltedPlane() calculates the p vector, it can overflow
if the view is near the bounds of the fixed point coordinate system. This
  happens because it rotates the view position around (0,0) according to
  the current viewangle, so the resultant coordinate may be outside the
  bounds of fixed point. All important math in this function is now done
  entirely in floating point.
- Fixed: Slopes didn't draw right on 64-bit platforms.


SVN r986 (trunk)
2008-05-22 05:17:21 +00:00
Christoph Oelckers e77f83fbf6 - Added new Scroll_Wall special to allow more control over wall scrolling.
Since it uses fixed point parameters it can only be used in scripts though.
- Added flags parameters to all wall scroller specials that didn't use
  all 5 args.
- Separated scrolling of the 3 different texture parts of a sidedef.
  While doing this I did some more restructuring of the sidedef structure
  and changed it so that all state changes to sidedefs that affect rendering 
  have to be made with access functions. This is not of much use to the
  software renderer but it allows far easier caching of rendering data
  for OpenGL because the only place I need to check is in the access functions.


SVN r832 (trunk)
2008-03-21 17:35:49 +00:00
Randy Heit 133350fb9c - Fixed AInventory::PickupFlash setting with GCC.
- Fixed: The MusicVolumes list was allocated with M_Malloc but freed with
  delete.
- Fixed: demobuffer was inconsistantly handled with new[]/delete[] and
  malloc/free.
- Added used memory tracking to M_Malloc() and M_Realloc(). This
  necessitated the addition of an M_Free() call to track frees.
- Removed M_Calloc since it was only used in one place, and can just as well
  be done with an M_Malloc/memset pair.
- Bumped DEMOGAMEVERSION for the new net controller codes.


SVN r751 (trunk)
2008-02-17 02:40:03 +00:00
Randy Heit e5572a1c4e - 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
Randy Heit 834e4bef32 - Changed the way gamma works for D3DFB: In windowed mode, the display is
drawn to a texture, then that texture is copied to the real back buffer
  using a gamma-correcting pixel shader. In fullscreen mode, SetGammaRamp
  is used.
- Fixed flashing of vid_fps display when fps > 1000.
- Fixed loading of RGB textures for native 2D mode.
- Changed the first rotozoomer's data because it just became too obvious when
  the backdrop is drawn with a full 256 distinct colors available.
- Set the player backdrop to update no more frequently than 35 FPS, so opening
  the player setup menu before starting a game won't produce a very fast
  moving backdrop.
- Changed the player backdrop into a texture so that it can be drawn like
  anything else.


SVN r648 (trunk)
2007-12-27 04:30:12 +00:00
Randy Heit c087e4d411 - New: When using the D3D9 framebuffer, palette blending is now applied only
to the 3D area of the screen. This means the console and (the primary
  rectangular area of) the status bar are no longer blended.


SVN r601 (trunk)
2007-12-18 01:50:08 +00:00