Commit graph

3268 commits

Author SHA1 Message Date
Yamagi
9654ed5562
Merge pull request #795 from DanielGibson/MSVC-upd
Support building with Visual Studio (via CMake)
2022-03-12 17:07:55 +01:00
Daniel Gibson
09ede9cf47 Make basename() fully compliant and simplify it a bit 2022-03-12 17:01:37 +01:00
Daniel Gibson
6c41a60c6d Make it work with VS2015 and newer
the workaround is a bit ugly but should work..
(I only tested VS2017, but I guess 2015 should also work)
2022-03-12 17:01:37 +01:00
Daniel Gibson
d0507ef04a Win32 Sys_Quit(): Don't use printf() after fclose(stdout)
causes an assertion in MSVC's CRT
2022-03-12 17:01:37 +01:00
Daniel Gibson
4a02c790e9 MSVC: Don't use YQ2_VLA() in loops
because on MSVC it uses alloca() (or _malloca()) which mustn't be called
in loops, as the memory is only freed when returning from the function,
not when leaving the scope (or before the next loop iteration).

Instead do one "dry-run" iteration to figure out how big the array must
be at most, and then allocate it once before the loop with that size.
2022-03-12 17:01:37 +01:00
Daniel Gibson
34a8c3833f Some CMake improvements
- make sure MSVC builds in parallel
- make sure game.dll ends up in the correct directory
- set yquake2 as VS debugger start project
2022-03-12 17:01:37 +01:00
Daniel Gibson
37b1b708c6 Fix some legitimate warnings from MSVC
MultiByteToWideChar() and other functions handlings WCHAR strings usually
expect length-like arguments in number of WCHARs, not in size in bytes
2022-03-12 17:01:37 +01:00
Daniel Gibson
16c97f6ece CMake: MSVC build is cleaner now (and shows less warnings)
- suppress some compiler warnings
- don't pass GCC/clang-specific flags to MSVC

(also made sure it still builds with MinGW)
2022-03-12 17:01:27 +01:00
Daniel Gibson
35232218e9 CMake: Correctly identify CPU architecture, hopefully
because, sadly, CMAKE_SYSTEM_PROCESSOR is almost useless and they don't
have a more useful alternative either :-/
2022-03-12 16:57:14 +01:00
Daniel Gibson
ed918cf423 CMake: Make the game build with Visual Studio (2019 16.8 or newer)
The easiest way to build this is to check out the dhewm3-libs project
(https://github.com/dhewm/dhewm3-libs/) to provide the dependencies
(SDL2, OpenAL, cURL) and set YQUAKE2LIBS accordingly, by passing
-DYQUAKE2LIBS=c:/path/to/dhewm3-libs/i686-w64-mingw32 to cmake.

I wouldn't really recommend building with MSVC - I just somehow made it
work and ignored all the warnings and I have no idea how portable the
resulting binaries are etc. For binaries you actually want to use, please
continue using MinGW-w64. Especially my workaround for VLAs (C99 variable
length arrays) is kinda fishy, particularly if those arrays are allocated
in a loop (that's inly done in ref_gl1.dll's code).

The only reason I did this is that I had to debug on Windows and, at least
for my specific bug, gdb didn't really work with binaries produced by
MingGW-w64 and MSVC's debugger works well with binaries produced by MSVC.

Currently requires VS 2019 16.8 or newer with C11 (/std:c11) because I
couldn't get YQ2_ALIGNAS_TYPE() to work with MSVC without _Alignas().
If we can get this to work, VS2015 or newer might suffice (but not older
versions, because their so called C standardlib didn't provide exotic
functions like snprintf()).

# Conflicts:
#	CMakeLists.txt
2022-03-12 16:55:55 +01:00
Yamagi
bbe639a7b0
Merge pull request #797 from devnexen/cmake_no_cxx
cmake limiting the scope of concern to C only and detecting
2022-03-12 16:39:22 +01:00
David Carlier
ea1d491ff3 cmake limiting the scope of concern to C only and detecting
the compiler from to one particular frontend since it can
happen to have differents for C and C++.
2022-03-02 19:31:37 +00:00
David Carlier
12509f6242 habdful of little simplifications. 2022-02-27 09:03:06 +00:00
Yamagi
7464cb7ae5 Document the HTTP downloading cvars.
For some reason I never added them to the documentation. Pointed out in
\#793, closes #793.
2022-02-26 17:34:16 +01:00
Yamagi
fca041c3ea
Merge pull request #792 from devnexen/cl_parse_overflow_fix
CL_ParseEntityBits overflow warning fix
2022-02-26 16:19:17 +01:00
Yamagi
0107b17764
Merge pull request #790 from devnexen/haiku_update_8
Haiku doc update, little code style fixes.
2022-02-26 16:18:59 +01:00
David Carlier
ff3315d5d6 Haiku doc update, little code style fixes. 2022-02-26 08:35:10 +00:00
David Carlier
ca4e5ef935 CL_ParseEntityBits overflow warning fix 2022-02-21 08:39:08 +00:00
Yamagi
e7df0977b0
Merge pull request #789 from apartfromtime/dev
Confirm delete save game through status bar update
2022-02-13 09:44:01 +01:00
apartfromtime
a7b90aaa24 Amend white-space error 2022-02-13 09:30:48 +11:00
Yamagi
b92165a0e1 Fix two unused var warnings introduced by #788. 2022-02-12 17:01:12 +01:00
Yamagi
b68910905b
Merge pull request #788 from 0lvin/softlightmap
soft: add r_lightmap implementation
2022-02-12 16:58:33 +01:00
apartfromtime
298a411b87 Confirm delete save game through status bar update 2022-02-12 14:56:08 +11:00
Denis Pauk
138fce15ea gl1,gl3: sync model light calculation 2022-02-05 18:54:38 +02:00
Denis Pauk
b4fb6db4fc gl1,gl3: rename gl_lightmap->r_lightmap 2022-02-05 18:54:38 +02:00
Denis Pauk
f1ac7cafbf soft: add r_lightmap implementation 2022-02-05 18:54:38 +02:00
Denis Pauk
eb979d73ed soft: resuse image load code for wal 2022-02-05 18:54:38 +02:00
Denis Pauk
0c2bf1f65d soft: use pixel_t in skin and load lightmap 2022-02-05 18:54:38 +02:00
Yamagi
7004565c72 Reset the clip mask in ThrowHead() to MASK_SHOT.
xatrix uses MASK_SHOT and it sounds saner than 0.
2022-02-05 17:26:48 +01:00
Yamagi
a0cd32dddb Fix door_go_up(), G_UseTargets() exiting early if no activator is given.
The problem in door_go_up() may prevent doors from crushing something
blocking them. The problem in G_UseTargets() may prevent targets from
getting killed or fired.

Pointed out by @maraakate.
2022-02-05 17:02:24 +01:00
Yamagi
9d827b13da Force an empty clip mask for thrown heads.
The ThrowHead() and ThrowClientHead() functions are special. They
transform the entity given in `self` (mostly the caller itself) into a
ripped off head. They don't reset the entities clip mask, which may
cause problems in interactions with other entities. Fix that by reseting
the clip mask to `0`. `0` should be save, because that's the default and
and least SV_TestEntityPosition() handles `0` clip masks.

Suggested by @BjossiAlfreds.
2022-02-05 16:55:12 +01:00
Yamagi
acf92bdd08 Add back call to rotation_blocked() lost in 896bb48.
If `ent->dmg` is `0` it's set to `2`:

```
if (!ent->dmg)
{
	ent->dmg = 2;
}
```

This enforces func_rotate dealing at least `2` damage points per tick.
Vanilla Quake II had this code a few lines below:

```
if (ent->dmg)
{
	ent->blocked = rotating_blocked;
}
```

The if clause is always true. PVS studio complained about that. By
mistake the whole block was removed, essentially preveting func_rotate
from freeing itself when blocked. This broke at least the 'Emulsifying
Flesh Press' in the fact2.bsp.

Closes #786.
2022-02-05 16:26:37 +01:00
Yamagi
896bb48d36
Merge pull request #780 from devnexen/m_main_draw_fix
menu code unused var warning fix.
2022-01-22 10:54:27 +01:00
Yamagi
aa561bf50b
Merge pull request #778 from 0lvin/fixes
cppcheck fixes
2022-01-22 10:51:21 +01:00
Yamagi
76e114b06a Bump version number to 8.02pre. 2022-01-22 09:51:53 +01:00
Yamagi
32fc209084 Bump version number to 8.01. 2022-01-22 09:51:28 +01:00
Denis Pauk
a48c7e1850 gl3: Scale 3x for nolerp 8bit textures 2022-01-18 00:02:54 +02:00
Denis Pauk
dcdc37ea35 gl1: Scale 3x for nolerp 8bit textures 2022-01-18 00:02:26 +02:00
David CARLIER
62fba5a29d menu code unused var warning fix. 2022-01-15 15:57:11 +00:00
Denis Pauk
f49235d28a disable sound effect debug prints 2022-01-13 22:54:21 +02:00
Denis Pauk
da4bbd64d6 soft: add const to functions parameters 2022-01-12 22:11:18 +02:00
Denis Pauk
68ad03aac9 sound: fix local variable 'ogg_file' shadows outer variable 2022-01-12 21:55:56 +02:00
Yamagi
6bec90bbdd Use Windows compatible format specifiers. 2022-01-08 18:05:36 +01:00
Yamagi
a0a8521497 Update CHANGELOG for 8.01.
This will be mostly a bugfix release.
2022-01-08 15:55:09 +01:00
Yamagi
d8c8bb0ba7
Merge pull request #775 from devnexen/curl_update_progress
client curl update proposal.
2021-12-24 08:52:55 +01:00
David Carlier
80ce342557 client curl update.
displaying download progress based on a new cvar, 0 by default.
2021-12-16 14:55:58 +00:00
Yamagi
f32d1e2ed7
Merge pull request #774 from BjossiAlfreds/waste3-fixes
Moved code hacks for waste3 to waste3.ent
2021-12-11 19:07:33 +01:00
Yamagi
76440d2a97
Merge pull request #771 from VespuCore/patch-1
Change the amount of listed renderers to 3 in documentation
2021-12-11 19:05:32 +01:00
BjossiAlfreds
b4ded6cb4f Additional fix for missing sound effect in waste3 in DM 2021-12-11 14:29:13 +00:00
BjossiAlfreds
65b1cd167c Moved code hacks for waste3 to waste3.ent and addressed more issues with that map 2021-12-11 14:02:09 +00:00