Commit graph

201 commits

Author SHA1 Message Date
Dave Milici 509da82ee8 Add -gl_stereoview option for selecting stereo viewport modes. 2021-03-12 10:07:45 -08:00
Dave Milici 4169183342 Initial stereo rendering test in side-by-side format.
OGL layer used for rendering surfaces, so using left/right viewports absent stereo quad buffers.
Using legacy Descent +/- eye offset method for left/right stereo perspective rendering passes.
2021-03-11 12:32:01 -08:00
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp 0c77bee1d9 Change PHYSFS_removeFromSearchPath to PHYSFS_unmount
Per the documentation, PHYSFS_removeFromSearchPath is a deprecated
wrapper for PHYSFS_unmount.  Call PHYSFS_unmount directly.
2020-12-27 22:03:09 +00:00
Kp fa648075a9 Change PHYSFS_addToSearchPath to PHYSFS_mount
Per the documentation, PHYSFS_addToSearchPath is a deprecated wrapper
for PHYSFS_mount.  Call PHYSFS_mount directly.
2020-12-27 22:03:09 +00:00
Kp 0c53d3a34f Replace PHYSFSX_isNewPath with !PHYSFS_getMountPoint
PHYSFSX_isNewPath retrieves from PhysFS a list of all paths, then
searches them, and frees them at the end.  PhysFS can search its own
list without needing the allocations, so delegate the work to it.
2020-12-27 22:03:09 +00:00
Kp fc63029833 Move more symbols into namespaces 2020-12-26 21:17:29 +00:00
Kp 665713f315 Remove static inline declarations from fwd-partial_range.h
A declaration is useful if it declares an external function.  A static
inline declaration, if not followed by the definition later in the same
translation unit, will not be useful.  Remove such declarations, and
rely on using the definition as a declaration for those files that
actually call partial_range() or similar functions.
2020-06-10 02:25:32 +00:00
Kp d06ad449b8 Always ignore from_hog_only
This fixes PCX loading in the non-editor build.  PCX loading broke in
3114874713 because it switched from PHYSFSX_openReadBuffered to a call
which did not handle the presence of the marker byte in the filename.

The from_hog_only flag has not been properly supported since the
introduction of PHYSFSX_openReadBuffered in
8b323e7214.  Editor builds ignored it on
purpose, and non-editor builds pretended to respect it, only to then
ignore it down inside PHYSFSX_openReadBuffered.  For consistency with
code paths that do not use PHYSFSX_openReadBuffered, disable the bypass
in PHYSFSX_openReadBuffered and remove the code in show_title_screen
that applied the flag.

Reported-by: Jayman2000 <https://github.com/dxx-rebirth/dxx-rebirth/issues/510>
Fixes: 3114874713 ("Delegate PCX loading to SDL_image")
2020-05-28 03:21:22 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp 705f15161f Simplify argument error reporting 2020-04-26 17:26:23 +00:00
Kp 15b0ec7f42 Fix externally reported Mac OS X build break
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:10:9: fatal error:
	  'CoreGraphics/CGBase.h' file not found
    #import <CoreGraphics/CGBase.h>
	    ^~~~~~~~~~~~~~~~~~~~~~~
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:10:9: note: did not
	  find header 'CGBase.h' in framework 'CoreGraphics' (loaded from
	  '/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks')
    similar/misc/physfsx.cpp:20:10: fatal error: 'HIServices/Processes.h' file not found
    #include <HIServices/Processes.h>

Since this is an OS X problem, this has only been tested by the original
reporter.

Reported-by: Sottises <https://github.com/dxx-rebirth/dxx-rebirth/issues/455>
Suggested-by: MaddTheSane <https://github.com/dxx-rebirth/dxx-rebirth/issues/455#issuecomment-536164089> # SConstruct part
2019-10-23 03:02:16 +00:00
Kp 2c91eda5bc Fix various gcc-9 -Wformat-truncation warnings 2019-05-06 00:36:16 +00:00
Kp 7558795edd Fix sharepath confusion when building both targets
Processing sharepath in SConf is incorrect, because targets can share a
build directory (and therefore an SConf run), but not share a sharepath.
Move sharepath handling out of SConf.  Move DXX_USE_SHAREPATH handling
from CGameArg to GameArg, since one game can be built with a sharepath
while the other is built without.
2019-01-20 05:36:56 +00:00
Kp 027cdaf568 Add debug log when sharepath is not used 2018-12-30 00:43:58 +00:00
Kp a705104e84 Check PHYSFS_init return value
PHYSFS_init is not guaranteed to succeed.  Using PHYSFS functions after
PHYSFS_init fails is likely to fail badly.  On Windows, failure may take
the form of a crash in ntdll.  Avoid this by exiting gracefully.
2018-12-08 23:36:18 +00:00
Kp 56d44459d4 Enable SHAREPATH for non-LinuxPlatformSettings 2018-09-14 02:20:55 +00:00
Kp 12b57e84e6 Switch most in-tree http:// links to https://
For each link given as http://, verify that the site is accessible over
https:// and, if so, switch to it.  These domains were converted:

* llvm.org
* clang.llvm.org
* en.cppreference.com
* www.dxx-rebirth.com
* www.libsdl.org
* www.scons.org
2018-09-02 00:57:29 +00:00
Kp 6a96e30495 Merge commit 'Quiet FSRef warnings' into master 2018-08-26 16:14:02 +00:00
C.W. Betts b9c6d59f11 Remove the forcing of null-termination of fullPath on OS X:
CFURLGetFileSystemRepresentation should already null-terminate its buffer.
2018-08-23 22:12:56 -06:00
C.W. Betts 0c48d99d2b Match the coding style of the rest of the document. 2018-08-23 21:29:03 -06:00
C.W. Betts 9cfa12c0fe Use sizeof(fullPath), as suggested by @vLKp. 2018-08-23 21:28:04 -06:00
C.W. Betts 746b61da8d Wrap the gobbler up in a preprocessor guard. 2018-08-22 12:10:33 -06:00
C.W. Betts e2a33dc81f Replace FSRef-dependant calls to CoreFoundation equivalents. 2018-08-21 13:40:25 -06:00
C.W. Betts fdf5a37c35 gobble up -psn command line options.
Should fix #387.
2018-08-21 13:04:21 -06:00
Kp f491059ed7 Enable building with SDL2
This commit enables Rebirth to build with SDL2, but the result is not
perfect.

- SDL2 removed some sticky key support.  Rebirth may behave differently
  now in this area.
- SDL2 removed some key-repeat related support.  Rebirth may behave
  differently now in this area.
- SDL2 gained the ability to make a window fullscreen by sizing it to
  the desktop instead of by changing the desktop resolution.  Rebirth
  uses this, and it mostly works.
  - Resizing while in the automap does not notify the automap code, so
    the view is wrong until the player switches out of automap mode and
    back in.
- SDL2 changed how to enumerate available resolutions.  Since
  fitting the window to the desktop is generally more useful than
  fitting the desktop to the window, I chose to drop support for
  enumerating resolutions instead of porting to the new API.  Users can
  now enter an arbitrary window dimension and Rebirth will make an
  attempt to use it.
  - It might be useful to cap the window dimension at the desktop
    dimension, but that is not done yet.
  - Entering fullscreen mode through the Controls->Graphics submenu
    failed to notify the relevant subsystems, causing the rendered
    content not to rescale.  For now, compile out the option to toggle
    full screen through that menu.  Toggling through Alt+Enter works
    properly.

Despite these quirks, this is a substantial improvement over the prior
commit, where SDL2 cannot be used at all.  The remaining issues can be
resolved in future work.

References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/82>
2018-07-28 23:22:58 +00:00
Kp 5526de4c10 Simplify case insensitive lookups 2018-06-13 02:02:58 +00:00
Kp 09cebc080c Undefine blank SHAREPATH
If user_settings.sharepath is configured to be blank in SConstruct, omit
the C preprocessor macro SHAREPATH instead of defining it to expand to
an empty string.  Adjust the C++ code that uses the macro SHAREPATH to
handle its absence:
- Clearer output in help text
- Skip adding blank SHAREPATH to the PhysFS search path.

As a nice side effect, this enables SHAREPATH on Windows, which could be
helpful for builds shipped with an installer that places game files in a
well-known location (such as "C:\Games\Descent").  Previously,
!defined(__unix__) systems did not add SHAREPATH to the PhysFS search
path, even when one was defined.
2018-05-17 02:49:15 +00:00
Kp 01e1b28d71 Replace useless printf with puts 2017-12-05 05:29:55 +00:00
Kp 3fbc710ec5 Move various SDL-only scanline functions to !DXX_USE_OGL
The OGL build compiles, but does not use, various scanline functions.
Move these to be built only for the SDL build.
2017-11-01 02:01:20 +00:00
Kp 88832e3679 Use constexpr integral_constant for various magic numbers 2017-10-14 17:10:30 +00:00
Kp a815541ef5 Fix check_header_includes=1 poison.h 2017-02-19 19:33:36 +00:00
Kp 171e87a1e7 Fix failure to unmap custom hogs 2016-12-17 18:39:18 +00:00
zico 78ad83a134 Fixed compile-time errors when using use_udp=0. Still some warnings but it builds. 2016-10-31 11:21:59 +01:00
Kp c006d068d8 Restructure PHYSFSX read helpers into template function 2016-10-17 03:49:31 +00:00
Kp 2d8928958d Fix some use_udp=0 build breaks
The build is still broken for use_udp=0.
2016-10-08 23:24:22 +00:00
Kp f24e9f836c Rename MAX_JOYSTICKS to DXX_MAX_JOYSTICKS
Rename symbol MAX_JOYSTICKS to DXX_MAX_JOYSTICKS to show that it is a DXX
symbol, not one inherited from a library.

git grep -lzw MAX_JOYSTICKS -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_JOYSTICKS\>/DXX_&/g'
2016-09-25 04:52:48 +00:00
Kp 62b58e9890 Move OGL to dxxsconf.h; rename to DXX_USE_OGL
Rename symbol OGL to DXX_USE_OGL to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -lzw OGL -- '*.h' '*.cpp' | xargs -0 sed -i -e 's/\(\s*#\s*if\)def\s*OGL/\1 DXX_USE_OGL/' -e 's/\(\s*#\s*if\)ndef OGL/\1 !DXX_USE_OGL/' -e 's/\(\s*#\s*if !\?\)defined(OGL)/\1DXX_USE_OGL/'
2016-09-24 18:06:11 +00:00
Kp 6a3ded191f Move EDITOR to dxxsconf.h; rename to DXX_USE_EDITOR
Rename symbol EDITOR to DXX_USE_EDITOR to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl EDITOR -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(EDITOR\)\>/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(EDITOR\))/#\1if \2DXX_USE_\3/' -e 's/^\s*#ifndef \(EDITOR\)\>/#if !DXX_USE_\1/'
2016-09-11 18:49:16 +00:00
Kp 435aa5a020 Move USE_UDP to dxxsconf.h; rename to DXX_USE_UDP
Rename symbol USE_UDP to DXX_USE_UDP to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -l USE_UDP -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(USE_UDP\)$/#if DXX_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(USE_UDP\))/#\1if \2DXX_\3/'
2016-09-11 18:49:15 +00:00
Kp 7c8c2b5aa4 Move USE_TRACKER to dxxsconf.h; rename to DXX_USE_TRACKER
Rename symbol USE_TRACKER to DXX_USE_TRACKER to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -l USE_TRACKER -- '*.h' '*.cpp' | xargs sed -i -e 's/^#ifdef \(USE_TRACKER\)$/#if DXX_\1/' -e 's/#\(el\)\?if \(.*\)defined(\(USE_TRACKER\))/#\1if \2DXX_\3/'
2016-09-11 18:49:15 +00:00
Kp ddf888cd72 Move USE_SDLMIXER to dxxsconf.h; rename to DXX_USE_SDLMIXER
Rename symbol USE_SDLMIXER to DXX_USE_SDLMIXER to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct and
inferno.cpp were manual.

git grep -l USE_SDLMIXER -- '*.h' '*.cpp' | xargs sed -i -e 's/^#ifdef \(USE_SDLMIXER\)$/#if DXX_\1/' -e 's/#\(el\)\?if \(.*\)defined(\(USE_SDLMIXER\))/#\1if \2DXX_\3/'
2016-09-11 18:49:15 +00:00
zico 8e097e79f0 Fixed byte offset in string for SDL_DISABLE_LOCK_KEYS, putting the 1 in place of the 0 instead on the terminator. 2016-09-05 11:31:22 +02:00
zico 6c6a32ba92 Added patch by user 'beware' to remove dark edges around textures and added command-line/INI option to disable this patch if desired (nostalgia). Fixed misleading indentation in ogl.cpp along the way. 2016-08-29 17:07:30 +02:00
Kp a09dce6ead Remove char[N] overload for PHYSFSX_getRealPath 2016-08-06 19:55:25 +00:00
Kp b0821cff55 Fix inverted sense of -use_players_dir
Fixes: 4d483ca88f ("Simplify use of SysUsePlayersDir")
2016-07-22 02:25:17 +00:00
Kp 4d483ca88f Simplify use of SysUsePlayersDir 2016-07-21 01:43:22 +00:00
Kp 231223895d Rewrite simple pointer casts from C style to reinterpret_cast<>
This pass only targets commonly used standard types.

s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\*\)\s*)\s*(/reinterpret_cast<\1>(/g
2016-06-05 01:04:26 +00:00
Kp 7fdce88558 Add parentheses around target of simple casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of simple C casts.

This pass does not attempt to process expressions that involve
any subexpression that can nest arbitrarily, such as parentheses or
brackets.  It also works only on commonly used standard types.

	(int) a->b;	// changed
	(int) a[b];	// not changed

s/\((\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\**\s*)\s*\)\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/\1(\5\6\7)\8/g
2016-06-05 01:04:25 +00:00
Kp b31446340c Rewrite cast of (ubyte*) to standard type uint8_t
s/(\s*ubyte\s*\*\s*)/(uint8_t *)/g
2016-06-05 01:04:25 +00:00