Commit graph

127 commits

Author SHA1 Message Date
Yamagi Burmeister
0264c6d946 Remove DOGG compile time option.
Having OGG optional only complicates things and is unnecessary now that
the dependencies to libvorbis and libogg are gone.
2018-08-14 10:40:50 +02:00
Yamagi Burmeister
e7fa5518a9 Replace zlib dependency by miniz single header library.
I've chosen the minimal invasive way for this:

  * Import miniz and remove -lz linker flags.
  * Create a short header minizconf.h roviding everything we need
    originally defined by zconf.h and not provided by miniz.
  * Replace zlib.h with miniz.h and minizconf.h.
2018-08-10 10:24:25 +02:00
Yamagi Burmeister
79e8c1377b Replace libvorbisfile with stb_vorbis single header lib.
This is (or at least should) work exactly the same a before but
saves us the dependencies to libogg, libvorbis and libvorbisfile.
2018-08-08 15:05:23 +02:00
Yamagi Burmeister
b97757e99f Some small make fixes. 2018-08-07 11:50:16 +02:00
Yamagi Burmeister
10bdaaec06 Move stb_image_write.h into vid. It's used there, only. 2018-08-07 11:45:26 +02:00
Yamagi Burmeister
d328aa9a9e Move rev.h into the client. 2018-08-07 10:20:02 +02:00
Yamagi Burmeister
5bff7e1568 Move refresh.c into the client and rename to glimp_sdl.c.
The GL backends have been an integral part of the vid interface for
years.
2018-08-07 10:08:20 +02:00
Yamagi Burmeister
b805b4e044 Move vid.c and dependencies into the client.
The vid interface has been exclusive to the client for years, trace
that in the file hierarchy.
2018-08-07 10:00:21 +02:00
Yamagi Burmeister
61400d1ae8 Move input.c and input.h into the client and rename to sdl.c.
The input system backend was once used in the client and the renderers,
but for some years now it has been an integral part of the client only.
Move it there.
2018-08-07 09:43:34 +02:00
Yamagi Burmeister
956902538f Move sound.c into the sound system source and rename to sdl.c.
The OpenAL backend was already part of the sound system source. And
there's no need for the SDL backend to be part of the generic backends.
2018-08-07 09:31:08 +02:00
Yamagi Burmeister
5501c38736 Move qal.c and qal.h to the other sound system sources.
The OpenAL backends used only by the sound system, there no need to
have them in the generic part of the sources.
2018-08-07 09:23:07 +02:00
Yamagi Burmeister
98d315ff20 Tell cmake that we prefer GLVND.
Yamagi Quake II runs fine with GLVND, most modern distros are using it,
so tell cmake about it and prevent some warnings.
2018-08-07 09:04:46 +02:00
Yamagi Burmeister
333d19766f Remove SDL 1.2 support from the build systems. 2018-07-31 14:32:13 +02:00
Yamagi Burmeister
307d5eecf7 Remove CDA and X11GAMMA build system support.
* CDA was only supported of the client was build with SDL 1.2. Our
  Windows binaries had no CDA support for years, I'm pretty sure that
  it never worked on Linux and no computer build after 2005 has even
  the necessary hardware. So let's just remove it.
* X11GAMMA was a hack to work around SDL 1.2s inability to set the
  gamma on newer xorg-server versions. It has been broken for some
  time now an is rather ugly. Remove it.

This is the first step in removing SDL 1.2 support.
2018-07-31 14:24:28 +02:00
Denis Pauk
f9a77d2d66 Share same Mod_DecompressVis 2018-07-23 17:40:06 +03:00
Yamagi Burmeister
176f95cc7c Enable backtrace printing on FreeBSD.
FreeBSD has supported printing backtraces for years. The API is the same
as on Linux, the only difference is that libexecinfo must be linked as a
seperate library. Since the last FreeBSD version with backtrace support
(FreeBSD 9.3) went out of support some time ago unconditionally enable
the printing.
2018-07-13 14:32:31 +02:00
Eric Wasylishen
a8902a0d82 CMakeLists.txt: use VORBIS_INCLUDE_DIR instead of OGGVORBIS_INCLUDE_DIR,
which doesn't seem to be set in the FindOggVorbis.cmake
2018-04-07 13:44:12 -06:00
Yamagi Burmeister
d6f9cf64a4 Enforce 32 bit IO-API for minizip on !Linux and !Windows.
By default minizip uses fopen64(), fseek64() and so on. Those may not
be defined on all system, especially the BSDs. While FreeBSD already
has a special case, for example OpenBSD hasn't. Work around this by
forcing minizip to use fopen(), fseek() and so on everything that's not
Linux or Windows. This is not 100% correct, it may prevent the usage of
ZIPs lager than 2GB on Solaris and other rarely used systems. But I
doubt that anyone has such large ZIPs with assets, they would likely hit
other internal limits.

In the future Quake II should use off_t instead of int were applicable.
With that we could set -D_FILE_OFFSET_BITS=64.

This change is based upon a patch send by @devnexen in pr #279.
2018-02-20 09:43:13 +01:00
Yamagi Burmeister
68e1cb6d00 Add stb_image_write.h to cmake. 2018-02-05 18:25:55 +01:00
Yamagi Burmeister
a65401d1af Rename mem.c to hunk.c.
hunk.c better describes the purpose of the code and matches the unix
backend.
2018-02-04 11:35:10 +01:00
Yamagi Burmeister
acb50c6907 Move the platform independent stuff from main() into Qcommon_*().
There's no need to duplicate machine independent parts of the client
initialization and the main loop for every platform.

While at it remove the nearly empty unix.h header and move Windows
main() into an own file. Not both platform have the same basic layout.
2018-02-04 11:35:10 +01:00
Yamagi Burmeister
7ee34acae8 Remove winquake.h
The only thing that header did was to include windows.h.
2018-02-04 11:35:10 +01:00
Yamagi Burmeister
de30b75f94 CMakeLists.txt: quake2.exe => yquake2.exe, add wrapper quake2.exe 2018-01-21 17:02:05 +01:00
Yamagi Burmeister
472f55c5bf Move the softrenderer constants into out constants/ dir. 2018-01-11 11:15:11 +01:00
Yamagi Burmeister
5592da9206 Rename all soft renderer files from r_* to sw_*. 2018-01-11 11:09:00 +01:00
Yamagi Burmeister
0e8b58952a Rename the gl/ directory to gl1/.
This is not strictly necessary but since we're calling it GL1 let's
stay consistent between the name and the directory structure.
2018-01-11 10:58:32 +01:00
Yamagi Burmeister
d21fbeb932 Rename all GL1 files from r_* to gl1_*. 2018-01-11 10:49:08 +01:00
Yamagi Burmeister
17f289c761 There's no need for the softrenderer to be build conditionally.
We want to build the softrenderer each time and on all platforms.
Building it only at user request will lead to code rot.
2018-01-10 10:33:24 +01:00
Yamagi Burmeister
aa4d92e8dd Rename gl_drawentities to r_drawentities. 2018-01-06 16:53:45 +01:00
Yamagi Burmeister
4d1b4fa88c Move the soft renderer header files into a subdirectory header/.
This matches the rest of YQ2s source tree.
2017-12-26 09:33:10 +01:00
Yamagi Burmeister
cc5e154511 Disable the softrenderer by default.
Before we can ship the softrenderer in the default install we'll need to
clean up the cvars. Currently the softrenderer is using the gl_* cvars
which is confusing.
2017-12-19 21:39:54 +01:00
Yamagi Burmeister
e3067a325c Implement CMake support for the new soft renderer. 2017-12-17 09:58:00 +01:00
David Carlier
6ed1898440 dlopen wrapper expects .dylib extension on osx 2017-10-01 17:46:18 +01:00
Yamagi Burmeister
e5c39eeb7f Set -ffloat-store when building with gcc for i386.
This helps the old and crappy x87 FPU to produce correct values. And
finally implement compiler detection in the Makefile.
2017-09-21 18:40:12 +02:00
Yamagi Burmeister
6ab2b3227a Rename common/misc.c to common/frame.c.
Now that we moved the CRC stuff to crc.c only the frame handling is
left in this files.
2017-09-07 13:31:52 +02:00
Alexander
0be75560fb fix opengl linking
The variable yquake2RendererLinkerFlags is used to store the linker flags for opengl but  the empty variable yquake2OpenGLLinkerFlags is used when linking libraries to the renderer.

Also there's no need to link the opengl libs to the opengl3 renderer when the glad extension loader is being used.
2017-08-02 14:59:31 +08:00
Yamagi Burmeister
7ca4e2ea5d Revert "Pass -Wno-misleading-indentation to silence spurious warnings."
Clang 4.0 doesn't like this and I'm too lazy to implement per compiler
CFLAGS.
2017-08-01 18:39:42 +02:00
Yamagi Burmeister
6da4a31740 Pass -Wno-misleading-indentation to silence spurious warnings.
Recent GCC versions print a lot of missleading indentation" warnings
in third party code, making the build log more or less unreadable.
2017-06-30 14:12:57 +02:00
Daniel Gibson
1da7ff5594 Fix Jennell Jaquays' name in credits and quit screen
the latter is done by identifying the baseq2 pics/quit.pcx in LoadPCX()
and changing some pixels
2017-06-12 18:32:56 +02:00
Yamagi Burmeister
4c8d504cf7 Enforce static linking of libgcc on Windows.
This is part of issue #205.
2017-06-10 10:01:05 +02:00
Yamagi Burmeister
a1e93ca647 Fix overlinking when building with cmake.
The CMakeLists.txt used the same linker flags for all target, grossly
overlinking q2ded and both render libraries. Fix this by introducing
fine grained variables holding the linker flags.
2017-04-18 17:38:50 +02:00
Yamagi Burmeister
7b5e13d4ff Add GL1 and GL3 refresh libraries to the CMakeLists.txt
I hope that I've referenced all headers required by the libraries. If
I missed some compilation will work but IDEs like Clion won't be able
to deduce all symbols.

Before this change cmake overlinked the q2ded binary and the game.so
game library. Now it is also the case with ref_gl1.so and ref_gl3. This
will be fixed in a later commit.
2017-04-10 15:50:25 +02:00
Yamagi Burmeister
4bd263c4d4 Some cleanup to the Makefile.
- Rename REFGL to REFGL1 for consistency with REFGL3.
- Fix some comments.
- There's no need to link flash.c and rand.c into both renderer libs.
2017-04-10 15:50:25 +02:00
Yamagi Burmeister
aa897e3965 Make OSTYPE and ARCH user defineable.
The old implementation had two problems:

  * OSTYPE and ARCH are systemwide defines, overriding them may break
    the global libc headers. This is a theoretical problem, I've never
    seen it in praxis.

  * Not all system set ARCH correctly when building in a chroot env.
    For example on Linux ARCH is set to x86_64 when building in an
    i386 chroot. Now the user can do something like "make YQ2ARCH=i386"
    to get things right.
2016-10-24 18:02:17 +02:00
Yamagi Burmeister
5a384c79b1 Switch from an arch whitelist to an "all archs are supported" approach.
The old whitelist was a leftover from the early days of YQ2. It should
run on most / all architectures, as long SDL supports them. As suggested
by smcv in issue #138 generate the OSTYPE and ARCH defines by the build
system instead of hardcoding it.

Savegame compatibility is provided by bumping the savegame version. Old
savegames are compared against the old OSTYPE and ARCH defined, new ones
against the new defines. This compatibility code should be removed
somewhere in the distant future.
2016-06-11 09:23:10 +02:00
Martin Hauke
629c714469 Cmake: Add option for systemwide installation of game assets 2016-03-17 09:00:50 +01:00
svdijk
5b6fdb2bde CMake: Remove unneeded PREFIX setting for executables 2015-11-05 21:52:52 +01:00
svdijk
11750e8273 CMake: Use a single output dir "release", like the official Makefile 2015-11-05 21:52:14 +01:00
svdijk
a6b0796f03 CMake: Whitespace 2015-11-05 21:18:03 +01:00
svdijk
1950e7ff8f CMake: Build "game" as a MODULE instead of as SHARED
This avoids building an unwanted libgame.dll.a when cross-compiling for Windows.
2015-11-05 21:09:22 +01:00
svdijk
e467850800 CMake: Don't link "game" into "q2ded" 2015-11-05 21:08:41 +01:00
svdijk
2c2b0562c2 CMake: Some cleanup (alphabetical order, whitspace). 2015-11-04 22:08:00 +01:00
svdijk
98cdc57140 CMake: Add the icon to Windows executables. 2015-11-04 21:22:48 +01:00
svdijk
00768dff9e CMake: Partial revert of b0479ce.
Because setting both a default target directory and a configuration specific target directory wouldn't work as intended with multi-configuration generators.
2015-11-04 20:44:12 +01:00
svdijk
b0479ce200 CMake: Fix output dir for DLLs, also default to Release dir for non-debug builds 2015-11-03 22:57:18 +01:00
svdijk
60232425bb CMake: Support YQUAKE2LIBS also for cross compiling 2015-11-03 22:12:46 +01:00
Yamagi Burmeister
6c43b2c725 Don't link game.so into quake2. That'll break everything :) 2015-08-23 18:50:48 +02:00
Yamagi Burmeister
767ec454fa Whitespace 2015-08-19 22:08:46 +02:00
Yamagi Burmeister
94ef1999b4 Introduce a CMake variable to define the libdir on Windows
As suggested by Daniel, use the same hack as dhewm3: The user defines a
path prefix and CMake does the rest. So this is enough to build on
Windows: cmake -G Unix\ Makefiles -DYQUAKE2LIBS=C:/MinGW/32/LIBS ..
2015-08-19 21:52:47 +02:00
Yamagi Burmeister
b89781d748 Support CMake on Microsoft Windows
This is a working CMake based build system for Windows:

- While this should work with system wide installed libraries, it's
  still highly recommended to use the latest version of our official
  Windows build environment.
- It was tested with out official build environment on Windows 7 with
  32 bit and 64 bit builds
- You'll need something in the lines of this nice and short command:
    cmake -G Unix\ Makefiles \
     -DSDL2_LIBRARY=C:/MinGW/32/LIBS/lib/libSDL2.dll.a \
     -DSDL2_INCLUDE_DIR=C:/MinGW/32/LIBS/include \
     -DZLIB_INCLUDE_DIR=C:/MinGW/32/LIBS/include \
     -DZLIB_LIBRARY=C:/MinGW/32/LIBS/lib/libz.a \
     -DOGG_LIBRARY=C:/MinGW/32/LIBS/lib/libogg.dll.a \
     -DOGG_INCLUDE_DIR=C:/MinGW/32/LIBS/include \
     -DVORBIS_LIBRARY=C:/MinGW/32/LIBS/lib/libvorbis.dll.a \
     -DVORBIS_INCLUDE_DIR=C:/MinGW/32/LIBS/include \
     -DVORBISFILE_LIBRARY=C:/MinGW/32/LIBS/lib/libvorbisfile.dll.a \
     -DVORBISENC_LIBRARY=C:/libvorbisenc.dll.a \
     -DOPENAL_LIBRARY=C:/MinGW/32/LIBS/lib/libOpenAL32.dll.a \
     -DOPENAL_INCLUDE_DIR=C:/MinGW/32/LIBS/include ..
 Yes, forward slashes! Backslashes will break!
2015-08-19 18:55:50 +02:00
Yamagi Burmeister
147021a89d Add header files to CMake
While headers are not required for compilation CMake need to have some
knowledge about them when used as a project management tool.
2015-08-12 19:19:37 +02:00
Yamagi Burmeister
870af22e75 Mention Clang for the sake of completeness. 2015-08-12 07:37:53 +02:00
Yamagi Burmeister
4eeac51574 Lower the optimization level to -O2
In the past -O3 was somewhat shaky. Quake II isn't the best and most
standard conformant code you can think of ;)
2015-08-11 21:55:29 +02:00
Yamagi Burmeister
88981bb930 Define some necessary compiler options 2015-08-11 21:55:21 +02:00
Yamagi Burmeister
dcf1fb2501 Move the new cmake directory into stuff/ to keep the top level clean 2015-08-11 21:24:17 +02:00
Yamagi Burmeister
6a059f2482 Whitespace cleanup 2015-08-11 21:21:05 +02:00
Yamagi Burmeister
ebece69254 Some minor cleanup to CMakeLists.txt
- Remove unneeded variables
- Define feature-defines without value
- Clearify some comments
2015-08-11 21:18:15 +02:00
Bradley Clemetson
567378ad50 If not specified create a debug build 2015-08-10 23:22:09 -07:00
Bradley Clemetson
2d20c5c801 Compiles on Linux with OpenAL support, SDL1/2 support.
Added build options for Zip/Ogg/OpenAL (On if available)
2015-08-10 22:55:01 -07:00
Bradley Clemetson
8211f5d497 Link to the proper DLOpen to remove linux ldl flag (Let Cmake handle it) 2015-08-10 21:53:49 -07:00
Bradley Clemetson
52ef7fe048 Added OGGVorbis support 2015-08-10 21:42:02 -07:00
Bradley Clemetson
7ffe618dc4
Updated versions to 5.3.0 2015-08-08 20:20:40 -07:00
Bradley Clemetson
e55f7e7aeb
Now builds fully on OS X 2015-08-08 20:19:03 -07:00
Bradley Clemetson
cf8f0d4787 Added OpenGL3 define to begin the transformation to modern GL!! 2015-08-08 18:10:10 -07:00
Bradley Clemetson
40cc2ee359 *Fixed building for MAC OS X 2015-08-08 18:10:10 -07:00
Bradley Clemetson
58bca4158c Added basic CMakeLists.txt configuration 2015-08-08 18:10:10 -07:00
Bradley Clemetson
bf2a0a3275 Stubbed blank cmake file 2015-08-08 18:10:10 -07:00