Commit Graph

273 Commits

Author SHA1 Message Date
mazmazz 930835f1a2 Dummy out OpenGL loading screen; fix console toggle so it doesn't actually show 2018-11-25 21:47:56 -05:00
mazmazz ea7162a76a Update source copyrights to 2018 2018-11-25 07:35:38 -05:00
Monster Iestyn 0a0336a674 Merge branch 'master' into fof-slope-skew-backport
# Conflicts:
#	src/r_segs.c
2018-11-23 22:40:28 +00:00
Alam Arias 30b9cef043
Merge pull request #326 from monster-psychic-cat/opengl_splitscreen_sky_fix
Render the skies correctly on splitscreen in OpenGL mode
2018-11-23 14:48:05 -05:00
Monster Iestyn 3e6fcf1b8b Merge branch 'opengl-hud-scale-fix' into 'master'
OpenGL HUD scaling fix

See merge request STJr/SRB2!320
2018-11-14 16:48:13 -05:00
Alam Ed Arias f73ea4f984 Clean up warnings 2018-11-14 10:52:16 -05:00
Monster Iestyn 0d38061db8 Fix V_SNAPTOx code to consider dupx/dupy the same way as Software mode 2018-11-13 18:13:51 +00:00
MPC eb4a72440a Render the skies correctly on splitscreen in OpenGL mode 2018-11-10 16:19:41 -03:00
Monster Iestyn 323c89dbaf fix using abs() on unsigned 2018-11-10 17:40:09 +00:00
Monster Iestyn dd83652b71 Whoops, this broke my non-NEWCLIP test build 2018-11-10 16:10:25 +00:00
Monster Iestyn c4569e61a8 Made some efforts to improve efficiency of new code, hard to tell if I've made it better or worse though honestly
R_IsEmptyLine is now a thing too btw
2018-11-10 16:09:21 +00:00
Monster Iestyn 1e98e3b4f2 More progress, NEWCLIP added to doomdef.h, sadly it actually all lags the game so I've disabled it for now
Other notes:
* on second thought I'll keep the hw_clip functions' gld prefixes rather than HWR, not like it matters either way
* despite the extra lag it does fix the issues with translucent walls and such when displayed at different vertical angles, such as with the GFZ1 waterfall
2018-11-10 16:08:56 +00:00
Monster Iestyn a733a29f4c Starting work on porting hw_clip.c/h code, Makefiles and CMake can compile them at least
Other notes:
* Renamed all new functions to have HWR_ prefix instead of gld_, for consistency
* HWR_FrustrumSetup and HWR_SphereInFrustum are disabled and require HAVE_SPHEREFRUSTRUM. This is because 1) SRB2CB did not need the code, so presumably neither will we, and 2) there are some OpenGL API functions used there that due to our way of using OpenGL we don't use outside of r_opengl.c, which makes dealing with HWR_FrustrumSetup complicated in theory
* The new clipping functions are not added to OpenGL's "main" rendering code itself just yet, they're just available to use now once hw_clip.h is included
2018-11-10 16:08:26 +00:00
Monster Iestyn 925a56ad98 Merge branch 'opengl-improvements-backport' into 'master'
Opengl improvements backport

See merge request STJr/SRB2!304
2018-11-10 09:25:18 -05:00
Monster Iestyn 2fa0896fd0 Fix an error I made in HWR_DrawFixedPatch 2018-10-30 13:44:01 +00:00
Monster Iestyn b022ff02a5 add missing SHORTs in HWR_DrawPatch and HWR_DrawCroppedPatch as well 2018-10-29 13:34:54 +00:00
Monster Iestyn f8fd8f8ec5 HWR_DrawFixedPatch: Add V_OFFSET support for V_FLIP in hardware code as well, also add missing SHORTs for gpatch fields 2018-10-29 13:29:16 +00:00
Monster Iestyn 32077897b6 Removed all remaining traces of VID_X11 code in hw_drv.h and hw_data.h, the macro is no longer used by Linux etc versions of SRB2.
Unlike the rest of the commits in this branch (as of writing), I didn't make this commit between 1 and 2 years ago, I made it right now ;)
2018-10-27 19:58:51 +01:00
Monster Iestyn aebcf3520b Remove pointless drawtextured variable and redundant fake planes checks (R_FakeFlat would already have made gr_frontsector/backsector something else if they were) 2018-10-27 19:32:55 +01:00
Monster Iestyn 3d88ee9d55 Added missing checks in HWR_AddLine from the software version, move v** vars to the top since R_PointToAngle calls use the same values anyway 2018-10-27 19:31:24 +01:00
Monster Iestyn 09eecd36b4 Hack to make sure even (extra)subsectors without planepolys have segs adjusted
this fixes a crash in (old) GFZ2 at the ramp as a result of creating pv1/pv2. This probably means before pv1/pv2 there could have been some silly typecasting from vertex_t to polyvertex_t to get fixed vertex coords and such...
2018-10-27 19:29:45 +01:00
Monster Iestyn 90cfa5ef16 Make new pv1/pv2 seg pointers, so AdjustSeg doesn't modify the v1/v2 pointers directly anymore
Yes I know they're void * in r_defs.h's seg_t definition, it's quicker than trying to figure out if including hardware/hw_glob.h is a good idea or not
2018-10-27 19:29:31 +01:00
Monster Iestyn 1cf2ce63c0 More optimising and otherwise fixing bizarre formatting in hw_trick.c 2018-10-27 18:58:05 +01:00
Monster Iestyn 2107aab666 Moved my added slope checks in hw_trick.c to isCeilingFloating/isFloorFloating
I also optimised those two functions while I was there (why keep a "floating" variable when setting it to false guarantees the functions return false?)
2018-10-27 18:57:28 +01:00
Monster Iestyn 787d5b598d gr_correcttricks fix: don't check if top/bottom textures are missing for sloped sectors, just ignore and cancel the hack
This fixes GFZ2's mysterious flying flats at the ramp to the big room
2018-10-27 18:56:38 +01:00
Monster Iestyn 67a2922558 Ensure file is closed whenever MD2 reading errors happen 2018-10-27 18:53:38 +01:00
Monster Iestyn b150e842fc Add MD2_INDENT and MD2_VERSION so we can cleanly check that it's a valid MD2 from magic number/version 2018-10-27 18:53:18 +01:00
mazmazz a288b95458 Merge remote-tracking branch 'public-gitlab/master' into public-music-cleanup 2018-10-19 22:04:26 -04:00
Monster Iestyn 61a29bed85 Remove unused sscount variable
(it's only set to 0 in software, and only ++'d in OpenGL, what kind of sense does that make?)
2018-10-11 19:59:26 +01:00
toaster b1e02467bf Weather is already run client-side. What if we ran it render-side, for major performance gains? This commit will answer all your questions - and more! 2018-10-07 15:00:58 +01:00
Monster Iestyn 872e2f82c1 Redo OpenGL skewing support, so that it now itself supports the lower unpegged effect for FOFs in OpenGL! 2018-09-28 17:02:02 +01:00
mazmazz 17cf310b84 nodigimusic nomusic nosound refactor other targets
(cherry picked from commit 86f151db654beb14e8d6893cdff2adaa965e8e4b)
2018-09-14 10:35:56 -04:00
Latapostrophe ad187c26f0 Repositionning chat & bugfixes 2018-07-31 15:57:19 +02:00
Latapostrophe ac7c249fd2 SRB2chat test rework 2018-07-31 11:10:02 +02:00
Monster Iestyn 8e19611033 Merge branch 'opengl-fof-lowerunpegged' into 'master'
OpenGL: FOF walls + Lower unpegged

See merge request STJr/SRB2!258
2018-07-11 16:36:26 -04:00
Monster Iestyn c127ea3ceb Merge branch 'opengl-projectsprite-fix' into 'master'
OpenGL HWR_ProjectSprite fix

See merge request STJr/SRB2!255
2018-07-11 16:15:42 -04:00
Monster Iestyn f1bba60373 Merge branch 'md2-fopen-error' into 'master'
More helpful error messages

See merge request STJr/SRB2!243
2018-07-06 14:38:59 -04:00
Monster Iestyn 130de10f97 Merge branch 'md2-smoother-interpolation' into 'master'
Smoother MD2 interpolation

See merge request STJr/SRB2!224
2018-07-06 14:38:37 -04:00
GoldenTails 761a221840 Merge remote-tracking branch 'STJrSRB2/master' into patch-1 2018-07-05 16:44:34 -05:00
Steel Titanium c8d0eb04f4 Merge remote-tracking branch 'upstream/master' into md2-smoother-interpolation 2018-07-05 01:23:56 -04:00
Steel Titanium c61035571b Merge remote-tracking branch 'upstream/master' into md2-fopen-error 2018-07-05 01:21:09 -04:00
Monster Iestyn d8a86a8d74 Fix OpenGL completely missing the ability to alter FOF wall pegging by lower unpegged flag. Stupid OpenGL.
Sorry in advance Lat'!
2018-06-26 21:41:05 +01:00
Monster Iestyn aed30519d4 Fix HWR_ProjectSprite to check properly whether the displayed player's mobj or its subsector exists, to avoid a crash when checking for fake planes. (also use viewplayer since its available to use, silly hardware code)
Also tweaked a weird splitscreen check in HWR_DrawSpriteShadow; still investigating whether stplyr is ever not player 2 when it's player 2's view, but this looks better for now
2018-06-23 18:47:32 +01:00
Monster Iestyn 8e5dbb22f0 Merge branch 'opengl-bigmap-fix' into 'master'
OpenGL: Very large map rendering issue fixed

See merge request STJr/SRB2!249
2018-06-03 15:08:10 -04:00
Sryder f4181f7eb6 Very large map rendering issue fixed
Move old fix for too large maps having rendering issues from R_CheckBBox to OpenGL's HWR_CheckBBox
From what I know, this effects at least Aerial Garden and Seraphic Skylands
2018-05-26 13:13:37 +01:00
Sryder badbb4324e Fix FF_FULLBRIGHT not working in sectors with multiple light levels in OpenGL 2018-05-16 21:04:57 +01:00
Steel Titanium b4d479ad9a Include errno if not already included. 2018-05-13 16:04:34 -04:00
Steel Titanium 7f084868b9 More helpful error message 2018-05-13 15:35:38 -04:00
GoldenTails 7783ddd134
Update hw_md2.c 2018-05-13 14:34:08 -05:00
GoldenTails 5f0a45124c
Update hw_md2.c 2018-05-13 14:32:33 -05:00
GoldenTails e66e0bb20e
Fixed MD2 models not loading correctly on Linux 2018-05-13 14:19:36 -05:00
Sryder 6f2de824fb Uncomment HWR_CorrectSWTricks but set gr_correcttricks to be off by default
I wasn't aware of the cvar, this should do for now since I don't believe any maps use these software tricks, probably an old leftover from DOOM.
2018-03-30 23:12:44 +01:00
Sryder 0aaae501d3 Warnings must die 2018-03-30 18:53:23 +01:00
Sryder f3aa02e26d Start with lightnum on sector lightlevel 2018-03-30 18:13:52 +01:00
Sryder 65c893da86 static tempsec for R_FakeFlat
I don't fully understand this, but it's what software does and it fixes the issue of the lighting in DSZ3. Also don't need the extra call to R_Prep3DFloors.
2018-03-29 23:28:54 +01:00
Sryder fab4b7f5ea Stop squashing the screen vertically in non-green resolutions 2018-03-22 01:10:53 +00:00
Sryder 839ee0ab85 OpenGL Sprite Splitting 2018-03-22 00:52:14 +00:00
Sryder 0885d27171 Transform sprites in world space rather than screen space
Transformation based on screen space would make sense if we didn't want anything in the world to effect the sprites.
This should allow sprite splitting and sorting of sprites with level geometry easier.
stransform is no longer needed.
2018-03-21 19:45:37 +00:00
Sryder 4e95066f5a Some fixes and updates for HWR_SplitWall
Solid walls *can* be cut
Fix issues with water and fog FOFs not cutting each other out correctly
Fix Fog colourmap and lighting setting that is done here.
Remove HWR_SplitFog

There is currently a bug with FF_DOUBLESHADOW (that also exists in software) but has a larger impact here. When 2 FF_DOUBLESHADOW lights are directly stacked on each other the bottom one has its height set incorrectly. This causes all the Fog in the timed gravity flipping section of ERZ2 to be drawn and it looks really bad.
2018-03-20 14:20:08 +00:00
Sryder f3d63b82ce Revert "Fix screenshot functionality in fullscreen in SDL2"
This reverts commit 121fcd8369.

The reason I am reverting this is because the last commit actually fixes the *old* screenshot functionality, as the screen is being drawn back onto the buffer after they're swapped in the "real" size. Meaning the old function actually works perfectly fine now.
2018-03-18 18:33:53 +00:00
Sryder a984d979d1 Fix wipes in low resolutions 2018-03-18 17:12:12 +00:00
Sryder 31d1ef8db0 Draw the final screen texture in the centre with black bars
Only applies when the monitor aspect ratio is different to the game's aspect ratio.
2018-03-17 19:22:14 +00:00
Sryder a9214ebd37 Match HWR_DrawCroppedPatch to V_DrawCroppedPatch 2018-03-17 13:58:44 +00:00
Sryder 801f7547d3 Add the full-screen drawfill functionality to HWR_DrawFixedPatch 2018-03-17 13:26:43 +00:00
Sryder 7830c031f7 Make HWR_DrawFill match V_DrawFill 2018-03-16 19:46:45 +00:00
Sryder 7764a1bb5d Match HWR_DrawFixedPatch to V_DrawFixedPatch 2018-03-16 18:08:24 +00:00
Sryder 1b3e1f78af Translucent floors shouldn't write into the depth buffer 2018-03-15 23:59:01 +00:00
Sryder 5a4ea9fab3 Better fog block colouring
They still aren't perfect, but now they are at least not quite so obviously just translucent polygons over the level. A mixture between partially modulating the background colours and adding the fog colour. Notably white fog blocks look like they're brightening what's behind them.
Additive was also setting noalphatest before, can probably decide that depending on what it needs anyway. I don't think it's currently used anyway.
2018-03-15 23:58:37 +00:00
Sryder e4ed3a793b Small hacky fix for MD2s and sprites until sorting for walls, floors, and sprites is done
Sorts all translucent sprites and MD2s so they're drawn after all the opaque ones. Fixes most of the observable issues between translucent MD2s and opaque sprites/MD2s.
2018-03-09 09:58:10 +00:00
Sryder 121fcd8369 Fix screenshot functionality in fullscreen in SDL2 2018-03-08 22:28:38 +00:00
Sryder 77af3a8f95 Optimise the screen texture setup for SDL2, Post-processor, and wipes.
Only use glCopyTexImage2D when first creating the screen texture, use glCopyTexSubImage2D anytime after that as it does not define a new texture each time.
Flushing of the screen textures has been implemented for when the screen size changes (so that the screen textures don't stay at a wrong size) and the game is closed, I believe they would leave a memory leak before.
2018-03-07 22:55:21 +00:00
Sryder 67ee1637c9 Decrease far clipping plane
The Far clipping plane did not need to be nearly as high as it was, the new value is 32768, which I suspect is about how far software can render before it completely falls apart.
It is desirable to increase the near clipping plane to between 6-10, but it can introduce more issues with close geometry not being drawn when the player or camera is scaled or viewheight is set to MIN in first person view. It would also stop sprites from being drawn ever so slightly too early, but this isn't too much of an issue and isn't too noticeable with those values. Might look into scaling near clipping plane in accordance to camera scale in the future.
The reason for wanting to increase the near clipping plane is because the small value can cause very noticeable Z-fighting where there shouldn't be on older GPU's, usually Intel ones, that don't support 24-bits for the depth buffer.
2018-03-07 00:39:33 +00:00
Sryder 538d0de949 Merge branch 'master' of git@git.magicalgirl.moe:STJr/SRB2.git into openglquickfixes 2018-03-06 16:11:05 +00:00
Steel Titanium 0cc4b8d6db Smoother MD2 interpolation 2018-02-06 14:50:08 -05:00
Alam Ed Arias f647989433 MSVC: set SubSystem on DLLs to Windows 2017-12-27 19:32:38 -05:00
Monster Iestyn 2b1fb67a5f DrawMD2i: change duration and tics to INT32, fix up any related code 2017-10-30 19:12:51 +00:00
Monster Iestyn 0cc8fbdb4e Don't use interpolation code if the frame lasts instantaneously or infinitely
Also removed the + 1 from newtime, since there was never really any need for it. It just offset the interpolation so it went like (1 -> 2] instead of [1 -> 2), so you never saw the base appearance for each frame except at the end of any frames interpolating to it

Changed DrawMD2Ex's duration/tics type to INT32 so -1 comparisons work, probably want to change the signs elsewhere too but this is fine for now
2017-10-24 20:45:55 +01:00
Alam Ed Arias 6fbdf37b18 Build: support building with clang 5.0 2017-09-30 08:54:17 -04:00
Sryder13 f3a605de6b I need to stop leaving things commented out that are going 2017-09-15 18:03:06 +01:00
Sryder13 db99537a6b Various Transparent Texture Fixes
Draw Textures and Flats that have holes in them like a solid polygon so they use the depth buffer and don't need to be sorted
Disable all linear filtering on textures and flats that have holes in them, the linear filtering introduces translucency into the textures where the edges are. Leaving them with either a black border, or causing pixels behind the slightly translucent areas to not be drawn. Doesn't apply to sprites and the HUD as they are always already sorted properly.
Make the Alpha Testing more strict on non-translucent blend modes. This makes it so any transparency below 0.5 is discarded instead. Would make anything that is blended and has holes in it look slightly better, only the HUD and MD2s where the texture has holes are effected currently.
Set TF_TRANSPARENT on flat texture flags when there are holes in the texture.
Minor fix to make sure MD2s always set the right blend mode
2017-09-09 00:44:13 +01:00
Sryder13 6877930ed9 Go through and draw MD2s and sprites at the same time so they are sorted from each other (mostly) correctly 2017-09-08 00:57:21 +01:00
Monster Iestyn b37d09df5f Merge branch 'opengl-slope-FOF-lighting-fix' into 'master'
OpenGL slope FOF lighting fix

This fixes some issues with sloped FOFs that affect lighting in OpenGL (as in, those that cast a shadow or have a colormap). Particularly, they can do strange things to any wall textures adjacent to them, as we've noticed ourselves in levels for 2.2. =P

See merge request !194
2017-06-22 19:49:42 -04:00
Monster Iestyn 6a0329857d Merge branch 'polyobject-seg-render-fix' into 'master'
Polyobject seg render fix

This fixes both Software and OpenGL renderers so that polyobject segs aren't drawn if the game is drawing the actual subsectors they're from (outside the main level, where the polyobject walls were pre-spawn). They should only appear as part of the polyobject itself in-level.

This means a few glitches with polyobjects are probably fixed: for instance in Software mode, polyobject walls sometimes appear through level boundaries (and make everything above/below vanish, turning into HOM or skybox), if the BSP rendering code happens to find one of the subsectors said segs came from outside the level. I don't think anything similar happens in OpenGL, though I'm sure some unwanted typecasting is happening as a result of attempting to draw the segs. (And it fixes a crash in 2.2 anyway.)

See merge request !195
2017-06-22 17:29:01 -04:00
Monster Iestyn c3c85bb4d2 Do not draw segs that belong to polyobjects, if you're drawing subsectors adjacent to them
Polyobject segs should ONLY be drawn if the polyobject itself is in the polylist of a subsector being rendered. That way you won't sometimes see polyobject walls through level boundaries, if you happen to be close enough to their pre-spawn locations outside the level (or in them, if you decided to go on a noclip journey).
2017-06-03 17:47:46 +01:00
Monster Iestyn 3658b22a7f wallVerts[].y is actually the map z coord, so use wallVerts[].z instead (which is actually the map y coord)
Don't worry I'm not going mad, this is actually how it's supposed to be
2017-06-03 14:46:03 +01:00
Alam Ed Arias 6847a89bc2 OpenGL: check for 1.3+ or 2.0+, not just 1.3/2.X to 4.X 2017-05-29 23:04:03 -04:00
Alam Ed Arias 6be7693ecb OpenGL: Load the GLU and OpenGL 1.3 multitexturing functions during runtime 2017-05-29 22:52:51 -04:00
Monster Iestyn f96844b262 Fix screenshots taken in OpenGL with 1366x768 being messed up
This is based on GZDoom's own fix for the same issue, had to add support for glPixelStorei first though
2017-05-29 21:28:36 +01:00
Alam Ed Arias 2823c7bffb build: fixup warnings from GCC 6.2.1 2017-03-12 17:23:56 -04:00
Monster Iestyn 87dc33a78d Merge branch 'master' into next 2017-01-08 15:59:34 +00:00
Monster Iestyn c601a409e1 Merge branch 'texture-fixes' into 'next'
Some texture-related fixes

Bugs fixed in this branch:
* upper/lower/middle textures with non-existent texture ids being capable of crashing the game. For instance, RVZ1 has colormap codes on non-colormap linedefs, which causes them to wind up with invalid texture ids because of how the game tries to interpret lower/upper textures with "#" followed by characters on normal linedefs. Fortunately these "textures" are normally not visible anyway (since they're all in control sectors) unless they are swapped with in-level textures by some crazy Lua script of some sort...
* animated single-patch textures with holes displaying garbage on first viewing (see this thread: https://mb.srb2.org/showthread.php?t=42195)
* the heights of the lighting (shadows or colormapping) from water/translucent/shadowcasting/etc FOFs become messed up when displayed on repeated midtextures.

See merge request !144
2017-01-06 21:15:22 -05:00
Alam Ed Arias 97f87827f4 hardware: init undef vars in HWR_SortVisSprites 2016-12-22 19:42:00 -05:00
Monster Iestyn a9cfd12e04 Created R_GetTextureNum to make sure top/bottom/midtexture texture ids are always valid in rendering code for both software and OpenGL (and also for the Solid Midtexture effect physics code) 2016-12-16 21:38:53 +00:00
Monster Iestyn 694bb73ef7 Merge branch 'master' into next 2016-11-16 12:16:51 +00:00
Monster Iestyn 42f985cda5 Remove pdupx/y and just use sdupx/y for everything, thanks Inuyasha 2016-11-16 12:10:56 +00:00
Monster Iestyn 0726dbe018 Started work on making HWR_DrawFill support V_NOSCALESTART properly ...so far I've got the console text select highlight in the right place outside of 320x200 (and 320x200 is still fine), but for whatever reason it's too large in width and height
Oh well, we're part of the way there, anyway
2016-11-15 20:33:07 +00:00
Monster Iestyn f97301b8b8 Merge branch 'master' into next 2016-11-06 17:59:35 +00:00
Monster Iestyn 2dfb841c38 Correcting slight mistake I made 2016-11-06 17:50:04 +00:00
Monster Iestyn 7b9328781f Merge branch 'master' into next 2016-11-05 19:36:04 +00:00
Monster Iestyn 8909b7c27b Change >= to >, I THINK having exactly 4096 vertices is safe? 2016-11-05 17:38:36 +00:00