Commit Graph

303 Commits

Author SHA1 Message Date
Simon McVittie a0e86c3c36 Make uses of pkg-config cross-compilation-friendly
Signed-off-by: Simon McVittie <smcv@debian.org>
2018-06-12 12:10:32 +01: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 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 bed6439d19 Convert the quake2.exe wrapper to a Windows GUI application.
While building the wrapper as a console application is completely fine
there're some advantages by creating a "real" Windows GUI Application:

* Console applications always spawn an annoying console window.
* Windows GUI applications seem to have a much lower chance to trigger
  my new best friend, the Windows Defender. As a console application
  quake.exe triggered every time I started it, as Windows GUI
  application not only once.

Use WinMain() instead of wWinMain() because MinGW doesn't know about
the later and it doesn't matter anyways.
2018-02-04 11:35:10 +01:00
Yamagi Burmeister cfddff132b Switch the windows backend SDLmain.
libSDLmain.a has to be linked and must run anyways. So there's no need
for us to reinvent the wheel, just rely on SDLs process setup, argument
parsing, message handling and so on. As a nice side effect this may fix
some strange bugs related to message handling and argument parsing...
2018-02-04 11:35:10 +01:00
Daniel Gibson 5c4f2cc5b0 quake2.exe wrapper: add icon 2018-01-21 16:40:05 +01:00
Daniel Gibson 7f8390d5f7 Makefile: quake2.exe => yquake2.exe, add wrapper quake2.exe 2018-01-21 16:40:05 +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 11ad28b711 Unify gl_mode and sw_mode in r_mode. 2018-01-09 14:03:45 +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 339c9da8a8 Enable the softrenderer by default. 2017-12-17 10:00:43 +01:00
Denis Pauk c43e944a3d Rebase soft render from https://icculus.org/quake2/
* deleted asm code
* added support 2k+ resolutions
* SDL2 support
2017-12-11 23:33:19 +02:00
Thomas Green daa0c2c1bf Add improvements to Makefile for OSX. 2017-10-22 17:54:55 +02: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
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
mulander 60bef10748 Don't use -Wl,--no-undefined on OpenBSD
Breaks the build since version 7.00
2017-07-20 17:47:56 +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
Simon McVittie 992f453016 Only use /usr/local/opt/openal-soft on Darwin
Commit 883781c selected these paths for all OSs, but when linking to
a system copy of OpenAL for Linux distribution binaries we want the
normal OpenAL in /usr.

Signed-off-by: Simon McVittie <smcv@debian.org>
2017-06-18 15:33:51 +01: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 c5f10dd879 Switch to a new, MSYS2 based build environment for Windows.
Highlights are:
- Since MSYS2 is much more unixlike than our old build environment we
  can remove most Windows specific hacks from the Makefile.
- MSYS2 has an package manager, the build environment can be updated
  by "pacman -Syu" just like an ordenary Arch Linux installation.
- Parallel builds are now working.
- git is integrated into the build envirment.
- zlib is now linked as a dynamic lib.

After this commit the old bild environment will no longer work! The
latest version must be downloaded and extracted to C:\MSYS2. Get it
here: https://deponie.yamagi.org/quake2/windows/build/
2017-05-25 11:21:52 +02:00
Yamagi Burmeister 38e60005cb Add back the GLAD_INCLUDE variable, lost in 4bd263c. 2017-04-10 19:22:23 +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
Daniel Gibson 54b38176ef Fix Windows build (missing OSTYPE => YQ2_OSTYPE in Makefile) 2017-04-04 17:34:19 +02:00
Daniel Gibson 182948fecc Rename ref_gl.* to ref_gl1.* 2017-04-02 16:23:00 +02:00
Daniel Gibson fcae894c1e Makefile: OSTYPE => YQ2_OSYTPE, ARCH => YQ2_ARCH, -std=gnu99
Hopefully this fixes the build on SUSE Linux.
2017-04-02 15:58:35 +02:00
Daniel Gibson 0d81fd6080 Fix OSX build (with Makefile) 2017-02-19 06:03:08 +01:00
Daniel Gibson 0b35ceabdc GL3: added missing source files and stubs of most functions
still no 3D rendering, but in theory it should be able to load models,
bsps etc, just not render them yet.

also moved/copied md2.c and sp2.c to gl/ and gl3/ because they use
renderer-specific types
2017-02-19 06:03:07 +01:00
Daniel Gibson 678410bfb4 Added super simple shaders, does render videos now 2017-02-19 06:03:07 +01:00
Daniel Gibson 56661fd43f GL3: Add remaining stubs, add HandMadeMath, update Copyrights 2017-02-19 06:03:07 +01:00
Daniel Gibson 64a456b867 Moved LoadWal() to r_image.c/gl3_image.c
It returns the renderer-specific image_t*; wal.c is now
renderer-agnostic and only contains GetWalInfo().
2017-02-19 06:03:07 +01:00
Daniel Gibson 9970dc43ad some further steps; ref_shared.h shared between ref libs
still nothing useful..
2017-02-19 06:03:07 +01:00
Daniel Gibson 324eaa8048 begin implementing ref_gl3
so far it can't even be loaded completely and has no code for
rendering yet
2017-02-19 06:03:07 +01:00
Daniel Gibson c901ad9bb6 Fix build on OSX 2017-02-19 06:03:07 +01:00
Daniel Gibson aaa73236ec refexport_t::Init() now returns bool and has no args; minor things
the arguments were not used anyway, and returning true/false is clearer
than returning -1 (for error) or sth else (which has no deeper meaning
anyway).

Also:
* PrepareForWindow() can now return -1 if there's an error
* suppress some warnings in Makefile
* fix error for building ref_gl.dylib on OSX
2017-02-19 06:03:07 +01:00
Daniel Gibson 4ede163794 Fix window build with Makefile
the problem is that sdl2-config --libs apparently includes shit that's only
useful for the executable, but not dlls, like linking against SDL2main and
libmingw32 and setting -mwindows

Furthermore I forgot to add -lopengl32 and -shared to the ref_gl Windows
LDFLAGS.
2017-02-19 06:03:07 +01:00
Daniel Gibson 7f27c549a8 It works again, ref_gl doesn't use any client symbols anymore
So in theory this should even work on Windows now.
2017-02-19 06:03:07 +01:00
Daniel Gibson 2062b319e9 move qgl.[ch] to src/client/refresh/gl/ 2017-02-19 05:53:56 +01:00
Daniel Gibson f13e15e561 ref_gl.so builds and works (on Linux, with Makefile)
still dirty, seems to use some symbols from client directly, which will
not work on Windows.
2017-02-19 05:53:56 +01:00
Daniel Gibson 883781c6f0 Also fix OSX build with OpenAL when *not* using dlopen()
using dlopen() (DLOPEN_OPENAL) is default, though.
2016-12-18 00:00:47 +01:00
Daniel Gibson 10899195b4 Fix OSX build with OpenAL if it's dlopen()'ed 2016-12-17 23:51:17 +01:00
Yamagi Burmeister 20caca09e3 Force the normal Windows build to OSTYPE := Windows
If someone really want's overwrite OSTYPE on Windows it's much easier to
just alter one line in the Makefile than supporting setting it through
the command line.
2016-12-03 09:17:21 +01:00
Yamagi Burmeister ae2b4744a1 MinGW defines a global OSTYPE. Just overwrite it. 2016-12-02 16:53:30 +01:00
Yamagi Burmeister e0b1f98f40 Make user overwriteable OSTYPE and ARCH somewhat more saner
In the Makefile we can use whatever variables we want. It's only
necessary that we don't leak them into the compiler context.
2016-10-31 10:22:17 +01: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